0

E:\Users\liuzhijun\workspace\mysite>python manage.py shell
---------------------------------- -----------------------------------------
TypeError Python 2.7.4: E:\ Python27\python.exe
Mon May 20 07:22:35 2013 Python コードの実行中に問題が発生しました。エラーが発生するまでの一連の関数呼び出しを次に示します。最新の (最も内側の) 呼び出しが最後です。

E:\Users\liuzhijun\workspace\mysite\manage.py in ()

  7 #!/usr/bin/env python
  8 import os
  9 import sys
---> 10
    global execute_from_command_line = <function execute_from_command_line at 0x02AF94F0>
    global sys.argv = ['manage.py', 'shell']
 11 if __name__ == "__main__":
 12     os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mysite.settings")
 13
 14     from django.core.management import execute_from_command_line
 15
 16     execute_from_command_line(sys.argv)
 17

E:\Python27\lib\site-packages\django\core\management__init__.pyc in execute_from_command_line(argv=['manage.py', 'shell'])

428         )
429
430     # Import the project module. We add the parent directory to PYTHONPATH to
431     # avoid some of the path errors new users can have.
432     sys.path.append(os.path.join(project_directory, os.pardir))
433     import_module(project_name)
434     sys.path.pop()
435
436     return project_directory
437
438 def execute_from_command_line(argv=None):
439     """
440     A simple method that runs a ManagementUtility.
441     """
442     utility = ManagementUtility(argv)
--> 443     utility.execute()
444
445 def execute_manager(settings_mod, argv=None):
446     """
447     Like execute_from_command_line(), but for use by manage.py, a
448     project-specific django-admin.py utility.
449     """
450     warnings.warn(
451         "The 'execute_manager' function is deprecated, "
452         "you likely need to update your 'manage.py'; "
453         "please see the Django 1.4 release notes "
454         "(https://docs.djangoproject.com/en/dev/releases/1.4/).",
455         PendingDeprecationWarning)
456
457     setup_environ(settings_mod)
458     utility = ManagementUtility(argv)

……たくさんのコードを省略……

更新:

E:\Python27\lib\site-packages\django\core\management__init__.pyc in execute(self=)

367             elif args[2] == '--commands':
368                 sys.stdout.write(self.main_help_text(commands_only=True) + '\n')
369             else:
370                 self.fetch_command(args[2]).print_help(self.prog_name, args[2])
371         elif subcommand == 'version':
372             sys.stdout.write(parser.get_version() + '\n')
373         # Special-cases: We want 'django-admin.py --version' and
374         # 'django-admin.py --help' to work, for backwards compatibility.
375         elif self.argv[1:] == ['--version']:
376             # LaxOptionParser already takes care of printing the version.
377             pass
378         elif self.argv[1:] in (['--help'], ['-h']):
379             parser.print_lax_help()
380             sys.stdout.write(self.main_help_text() + '\n')
381         else:
--> 382             self.fetch_command(subcommand).run_from_argv(self.argv)
383
384 def setup_environ(settings_mod, original_settings_path=None):
385     """
386     Configures the runtime environment. This can also be used by external
387     scripts wanting to set up a similar environment to manage.py.
388     Returns the project directory (assuming the passed settings module is
389     directly in the project directory).
390
391     The "original_settings_path" parameter is optional, but recommended, since
392     trying to work out the original path from the module can be problematic.
393     """
394     warnings.warn(
395         "The 'setup_environ' function is deprecated, "
396         "you likely need to update your 'manage.py'; "
397         "please see the Django 1.4 release notes "

E:\Python27\lib\site-packages\django\core\management\base.pyc in run_from_argv(self=, argv=['manage.py', 'shell'])

181         ``self.usage()``.
182
183         """
184         parser = self.create_parser(prog_name, subcommand)
185         parser.print_help()
186
187     def run_from_argv(self, argv):
188         """
189         Set up any environment changes requested (e.g., Python path
190         and Django settings), then run this command.
191
192         """
193         parser = self.create_parser(argv[0], argv[1])
194         options, args = parser.parse_args(argv[2:])
195         handle_default_options(options)
--> 196         self.execute(*args, **options.__dict__)
    global s = undefined
    global appname = undefined
    global appname...c = undefined
197
198     def execute(self, *args, **options):
199         """
200         Try to execute this command, performing model validation if
201         needed (as controlled by the attribute
202         ``self.requires_model_validation``). If the command raises a
203         ``CommandError``, intercept it and print it sensibly to
204         stderr.
205         """
206         show_traceback = options.get('traceback', False)
207
208         # Switch to English, because django-admin.py creates database content
209         # like permissions, and those shouldn't contain any translations.
210         # But only do this if we can assume we have a working settings file,
211         # because django.utils.translation requires settings.

E:\Python27\lib\site-packages\django\core\management\base.pyc in execute(self=, *args=(), **options={'plain': None, 'pythonpath': None, ' settings': なし、'traceback': なし、'verbosity':'1'})

217                 translation.activate('en-us')
218             except ImportError, e:
219                 # If settings should be available, but aren't,
220                 # raise the error and quit.
221                 if show_traceback:
222                     traceback.print_exc()
223                 else:
224                     sys.stderr.write(smart_str(self.style.ERROR('Error: %s\n' % e)))
225                 sys.exit(1)
226
227         try:
228             self.stdout = options.get('stdout', sys.stdout)
229             self.stderr = options.get('stderr', sys.stderr)
230             if self.requires_model_validation:
231                 self.validate()
--> 232             output = self.handle(*args, **options)
    global Rather = undefined
    global than = undefined
    global implementing = undefined
    global handle = undefined
    global subclasses = undefined
    global must = undefined
    global implement = undefined
233             if output:
234                 if self.output_transaction:
235                     # This needs to be imported here, because it relies on
236                     # settings.
237                     from django.db import connections, DEFAULT_DB_ALIAS
238                     connection = connections[options.get('database', DEFAULT_DB_ALIAS)]
239                     if connection.ops.start_transaction_sql():
240                         self.stdout.write(self.style.SQL_KEYWORD(connection.ops.start_transaction_sql()) + '\n')

241                 self.stdout.write(output)
242                 if self.output_transaction:
243                     self.stdout.write('\n' + self.style.SQL_KEYWORD("COMMIT;") + '\n')
244         except CommandError, e:
245             if show_traceback:
246                 traceback.print_exc()
247             else:

E:\Python27\lib\site-packages\django\core\management\base.pyc in handle(self=, *args=(), **options={'plain': None, 'pythonpath': None, ' settings': なし、'traceback': なし、'verbosity': '1'})

356     """
357     A command which takes no arguments on the command line.
358
359     Rather than implementing ``handle()``, subclasses must implement
360     ``handle_noargs()``; ``handle()`` itself is overridden to ensure
361     no arguments are passed to the command.
362
363     Attempting to pass arguments will raise ``CommandError``.
364
365     """
366     args = ''
367
368     def handle(self, *args, **options):
369         if args:
370             raise CommandError("Command doesn't accept any arguments")
 --> 371         return self.handle_noargs(**options)
372
373     def handle_noargs(self, **options):
374         """
375         Perform this command's actions.
376
377         """
378         raise NotImplementedError()
379
380
381
382
383
384
385
386

E:\Python27\lib\site-packages\django\core\management\commands\shell.pyc in handle_noargs(self=, **options={'plain': なし, 'pythonpath': なし, 'settings': なし, 'traceback': なし, 'verbos ity': '1'})

 39                 pass
 40         raise ImportError
 41
 42     def handle_noargs(self, **options):
 43         # XXX: (Temporary) workaround for ticket #1796: force early loading of all
 44         # models from installed apps.
 45         from django.db.models.loading import get_models
 46         get_models()
 47
 48         use_plain = options.get('plain', False)
 49
 50         try:
 51             if use_plain:
 52                 # Don't bother loading IPython, because the user wants plain Python.
 53                 raise ImportError
 ---> 54             self.run_shell()
 55         except ImportError:
 56             import code
 57             # Set up a dictionary to serve as the environment for the shell, so
 58             # that tab completion works on objects that are imported at runtime.
 59             # See ticket 5082.
 60             imported_objects = {}
 61             try: # Try activating rlcompleter, because it's handy.
 62                 import readline
 63             except ImportError:
 64                 pass
 65             else:
 66                 # We don't have to wrap the following import in a 'try', because
 67                 # we already know 'readline' was imported successfully.
 68                 import rlcompleter
 69                 readline.set_completer(rlcompleter.Completer(imported_objects).complete)

E:\Python27\lib\site-packages\django\core\management\commands\shell.pyc in run_shell(self=)

 22             try:
 23                 from IPython.Shell import IPShell
 24                 shell = IPShell(argv=[])
 25                 shell.mainloop()
 26             except ImportError:
 27                 # IPython not found at all, raise ImportError
 28                 raise
 29
 30     def bpython(self):
 31         import bpython
 32         bpython.embed()
 33
 34     def run_shell(self):
 35         for shell in self.shells:
 36             try:
 ---> 37                 return getattr(self, shell)()
    global t = undefined
    global __name__t = undefined
 38             except ImportError:
 39                 pass
 40         raise ImportError
 41
 42     def handle_noargs(self, **options):
 43         # XXX: (Temporary) workaround for ticket #1796: force early loading of all
 44         # models from installed apps.
 45         from django.db.models.loading import get_models
 46         get_models()
 47
 48         use_plain = options.get('plain', False)
 49
 50         try:
 51             if use_plain:
 52                 # Don't bother loading IPython, because the user wants plain Python.

E:\Python27\lib\site-packages\django\core\management\commands\shell.pyc in ipython(self=)

  9     )
 10     help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available."
 11     shells = ['ipython', 'bpython']
 12     requires_model_validation = False
 13
 14     def ipython(self):
 15         try:
 16             from IPython import embed
 17             embed()
 18         except ImportError:
 19             # IPython < 0.11
 20             # Explicitly pass an empty list as arguments, because otherwise
 21             # IPython would use sys.argv from this script.
 22             try:
 23                 from IPython.Shell import IPShell
 ---> 24                 shell = IPShell(argv=[])
    global j = undefined
    global d = undefined
    global s = undefined
    global t = undefined
 25                 shell.mainloop()
 26             except ImportError:
 27                 # IPython not found at all, raise ImportError
 28                 raise
 29
 30     def bpython(self):
 31         import bpython
 32         bpython.embed()
 33
 34     def run_shell(self):
 35         for shell in self.shells:
 36             try:
 37                 return getattr(self, shell)()
 38             except ImportError:
 39                 pass

E:\Python27\lib\site-packages\IPython\Shell.pyc in init (self=, argv=[], user_ns=None, user_global_ns=None, debug=1, shell_class=)

 58 # Default timeout for waiting for multithreaded shells (in seconds)
 59 GUI_TIMEOUT = 10
 60
 61 #-----------------------------------------------------------------------------
 62 # This class is trivial now, but I want to have it in to publish a clean
 63 # interface. Later when the internals are reorganized, code that uses this
 64 # shouldn't have to change.
 65
 66 class IPShell:
 67     """Create an IPython instance."""
 68
 69     def __init__(self,argv=None,user_ns=None,user_global_ns=None,
 70                  debug=1,shell_class=InteractiveShell):
 71         self.IP = make_IPython(argv,user_ns=user_ns,
 72                                user_global_ns=user_global_ns,
 ---> 73                                debug=debug,shell_class=shell_class)
    global For = undefined
    global more = undefined
    global details = undefined
    global see = undefined
    global the = undefined
    global __call__ = undefined
    global method = undefined
    global below. = undefined
 74
 75     def mainloop(self,sys_exit=0,banner=None):
 76         self.IP.mainloop(banner)
 77         if sys_exit:
 78             sys.exit()
 79
 80 #-----------------------------------------------------------------------------
 81 def kill_embedded(self,parameter_s=''):
 82     """%kill_embedded : deactivate for good the current embedded IPython.
 83
 84     This function (after asking for confirmation) sets an internal flag so that
 85     an embedded IPython will never activate again.  This is useful to
 86     permanently disable a shell that is being called inside a loop: once you've
 87     figured out what you needed from it, you may then kill it and the program
 88     will then continue to run without the interactive shell interfering again.

E:\Python27\lib\site-packages\IPython\ipmaker.pyc in make_IPython(argv=[], user_ns=None, user_global_ns=None, debug=1, rc_override=None, shell_class=, embedded=False, **kw ={})

506     # tweaks. Basically options which affect other options. I guess this
507     # should just be written so that options are fully orthogonal and we
508     # wouldn't worry about this stuff!
509
510     if IP_rc.classic:
511         IP_rc.quick = 1
512         IP_rc.cache_size = 0
513         IP_rc.pprint = 0
514         IP_rc.prompt_in1 = '>>> '
515         IP_rc.prompt_in2 = '... '
516         IP_rc.prompt_out = ''
517         IP_rc.separate_in = IP_rc.separate_out = IP_rc.separate_out2 = '0'
518         IP_rc.colors = 'NoColor'
519         IP_rc.xmode = 'Plain'
520
--> 521     IP.pre_config_initialization()
522     # configure readline
523
524     # update exception handlers with rc file status
525     otrap.trap_out()  # I don't want these messages ever.
526     IP.magic_xmode(IP_rc.xmode)
527     otrap.release_out()
528
529     # activate logging if requested and not reloading a log
530     if IP_rc.logplay:
531         IP.magic_logstart(IP_rc.logplay + ' append')
532     elif  IP_rc.logfile:
533         IP.magic_logstart(IP_rc.logfile)
534     elif IP_rc.log:
535         IP.magic_logstart()
536

E:\Python27\lib\site-packages\IPython\iplib.pyc in pre_config_initialization(self=)

820                           self.user_ns,  # globals
821                           # Skip our own frame in searching for locals:
822                           sys._getframe(depth+1).f_locals # locals
823                           ))
824
825     def pre_config_initialization(self):
826         """Pre-configuration init method
827
828         This is called before the configuration files are processed to
829         prepare the services the config files might need.
830
831         self.rc already has reasonable default values at this point.
832         """
833         rc = self.rc
834         try:
--> 835             self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db")
    global prompt = undefined
    global a = undefined
    global string = <module 'string' from 'E:\Python27\lib\string.pyc'>
    global to = undefined
    global be = undefined
    global printed = undefined
    global the = undefined
    global user. = undefined
836         except exceptions.UnicodeDecodeError:
837             print "Your ipythondir can't be decoded to unicode!"
838             print "Please set HOME environment variable to something that"
839             print r"only has ASCII characters, e.g. c:\home"
840             print "Now it is",rc.ipythondir
841             sys.exit()
842         self.shadowhist = IPython.history.ShadowHist(self.db)
843
844     def post_config_initialization(self):
845         """Post configuration init method
846
847         This is called after the configuration files have been processed to
848         'finalize' the initialization."""
849
850         rc = self.rc

E:\Python27\lib\site-packages\IPython\Extensions\pickleshare.pyc in init (self=PickleShareDB('C:\Users\liuzhijun_ipython\db'),root=u'C:\Users\liuzhijun\_ipython/ db')

 38 import cPickle as pickle
 39 import UserDict
 40 import warnings
 41 import glob
 42
 43 def gethashfile(key):
 44     return ("%02x" % abs(hash(key) % 256))[-2:]
 45
 46 _sentinel = object()
 47
 48 class PickleShareDB(UserDict.DictMixin):
 49     """ The main 'connection' object for PickleShare database """
 50     def __init__(self,root):
 51         """ Return a db object that will manage the specied directory"""
 52         self.root = Path(root).expanduser().abspath()
 ---> 53         if not self.root.isdir():
 54             self.root.makedirs()
 55         # cache has { 'key' : (obj, orig_mod_time) }
 56         self.cache = {}
 57
 58
 59     def __getitem__(self,key):
 60         """ db['key'] reading """
 61         fil = self.root / key
 62         try:
 63             mtime = (fil.stat()[stat.ST_MTIME])
 64         except OSError:
 65             raise KeyError(key)
 66
 67         if fil in self.cache and mtime == self.cache[fil][1]:
 68             return self.cache[fil][0]

TypeError: _isdir() は正確に 1 つの引数を取ります (0 を指定)

おっと、IPython がクラッシュしました。安定させるために最善を尽くしますが...

次の情報を含むクラッシュ レポートが自動的に生成されました。 - クラッシュ トレースバックの逐語的なコピー。- このセッションでの入力履歴のコピー。- 現在の IPython 構成に関するデータ。

「C:\Users\liuzhijun_ipython\IPython_crash_report.txt」という名前のファイルに残されていました。このファイルを開発者に電子メールで送信できる場合は、その中の情報が問題の理解と修正に役立ちます。

次の宛先にメールで送信できます: fperez.net@gmail.com の Fernando Perez 宛てに、件名を「IPython Crash Report」にしてください。

今すぐやりたい場合は、次のコマンドが機能します (Unix 環境で): mail -s 'IPython Crash Report' fperez.net@gmail.com < C:\Users\liuzhijun_ipython\IPython_crash_report.txt

この問題を正確に追跡するには、 https ://bugs.launchpad.net/ipython/+filebug でレポートを提出してください。

Enter キーを押して終了します。

システム環境:windows8

4

0 に答える 0