django - run python manage.py shell occurs errors -


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 problem occured executing python code. here sequence of function calls leading error, recent (innermost) call last.

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 @ 0x02af94f0>     global sys.argv = ['manage.py', 'shell']  11 if __name__ == "__main__":  12     os.environ.setdefault("django_settings_module", "mysite.settings")  13  14     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 project module. add parent directory pythonpath 431     # avoid of 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     simple method runs managementutility. 441     """ 442     utility = managementutility(argv) --> 443     utility.execute() 444 445 def execute_manager(settings_mod, argv=none): 446     """ 447     execute_from_command_line(), use manage.py, 448     project-specific django-admin.py utility. 449     """ 450     warnings.warn( 451         "the 'execute_manager' function deprecated, " 452         "you need update 'manage.py'; " 453         "please see 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) 

......omit lots of codes......

update:

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: want 'django-admin.py --version' , 374         # 'django-admin.py --help' work, backwards compatibility. 375         elif self.argv[1:] == ['--version']: 376             # laxoptionparser takes care of printing 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 runtime environment. can used external 387     scripts wanting set similar environment manage.py. 388     returns project directory (assuming passed settings module 389     directly in project directory). 390 391     "original_settings_path" parameter optional, recommended, since 392     trying work out original path module can problematic. 393     """ 394     warnings.warn( 395         "the 'setup_environ' function deprecated, " 396         "you need update 'manage.py'; " 397         "please see 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 environment changes requested (e.g., python path 190         , django settings), run 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 execute command, performing model validation if 201         needed (as controlled attribute 202         ``self.requires_model_validation``). if command raises 203         ``commanderror``, intercept , print sensibly 204         stderr. 205         """ 206         show_traceback = options.get('traceback', false) 207 208         # switch english, because django-admin.py creates database content 209         # permissions, , shouldn't contain translations. 210         # if can assume have 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': none, 'traceback': none, 'verbosity':'1'})

217                 translation.activate('en-us') 218             except importerror, e: 219                 # if settings should available, aren't, 220                 # raise error , 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 = 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                     # needs imported here, because relies on 236                     # settings. 237                     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': none, 'traceback': none, 'verbosity': '1'})

356     """ 357     command takes no arguments on command line. 358 359     rather implementing ``handle()``, subclasses must implement 360     ``handle_noargs()``; ``handle()`` overridden ensure 361     no arguments passed command. 362 363     attempting pass arguments raise ``commanderror``. 364 365     """ 366     args = '' 367 368     def handle(self, *args, **options): 369         if args: 370             raise commanderror("command doesn't accept arguments")  --> 371         return self.handle_noargs(**options) 372 373     def handle_noargs(self, **options): 374         """ 375         perform 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': none, 'pythonpath': none, 'settings': none, 'traceback': none, 'verbos ity': '1'})

 39                 pass  40         raise importerror  41  42     def handle_noargs(self, **options):  43         # xxx: (temporary) workaround ticket #1796: force loading of  44         # models installed apps.  45         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 user wants plain python.  53                 raise importerror  ---> 54             self.run_shell()  55         except importerror:  56             import code  57             # set dictionary serve environment shell,  58             # tab completion works on objects imported @ 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                 # don't have wrap following import in 'try', because  67                 # know 'readline' 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                 ipython.shell import ipshell  24                 shell = ipshell(argv=[])  25                 shell.mainloop()  26             except importerror:  27                 # ipython not found @ all, raise importerror  28                 raise  29  30     def bpython(self):  31         import bpython  32         bpython.embed()  33  34     def run_shell(self):  35         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 ticket #1796: force loading of  44         # models installed apps.  45         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 user wants plain python. 

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

  9     )  10     = "runs python interactive interpreter. tries use ipython, if it's available."  11     shells = ['ipython', 'bpython']  12     requires_model_validation = false  13  14     def ipython(self):  15         try:  16             ipython import embed  17             embed()  18         except importerror:  19             # ipython < 0.11  20             # explicitly pass empty list arguments, because otherwise  21             # ipython use sys.argv script.  22             try:  23                 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 @ all, raise importerror  28                 raise  29  30     def bpython(self):  31         import bpython  32         bpython.embed()  33  34     def run_shell(self):  35         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 waiting multithreaded shells (in seconds)  59 gui_timeout = 10  60  61 #-----------------------------------------------------------------------------  62 # class trivial now, want have in publish clean  63 # interface. later when internals reorganized, code uses  64 # shouldn't have change.  65  66 class ipshell:  67     """create 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 = undefined     global more = undefined     global details = undefined     global see = undefined     global = 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 current embedded ipython.  83  84     function (after asking confirmation) sets internal flag  85     embedded ipython never activate again.  useful  86     permanently disable shell being called inside loop: once you've  87     figured out needed it, may kill , program  88     continue run without 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. options affect other options. guess 507     # should written options orthogonal , 508     # wouldn't worry 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 rc file status 525     otrap.trap_out()  # don't want these messages ever. 526     ip.magic_xmode(ip_rc.xmode) 527     otrap.release_out() 528 529     # activate logging if requested , not reloading 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 locals: 822                           sys._getframe(depth+1).f_locals # locals 823                           )) 824 825     def pre_config_initialization(self): 826         """pre-configuration init method 827 828         called before configuration files processed 829         prepare services config files might need. 830 831         self.rc has reasonable default values @ point. 832         """ 833         rc = self.rc 834         try: --> 835             self.db = pickleshare.picklesharedb(rc.ipythondir + "/db")     global prompt = undefined     global = undefined     global string = <module 'string' 'e:\python27\lib\string.pyc'>     global = undefined     global = undefined     global printed = undefined     global = undefined     global user. = undefined 836         except exceptions.unicodedecodeerror: 837             print "your ipythondir can't decoded unicode!" 838             print "please set home environment variable that" 839             print r"only has ascii characters, e.g. c:\home" 840             print "now 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         called after configuration files have been processed 848         'finalize' 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 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     """ main 'connection' object pickleshare database """  50     def __init__(self,root):  51         """ return db object manage 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 , mtime == self.cache[fil][1]:  68             return self.cache[fil][0] 

typeerror: _isdir() takes 1 argument (0 given)

oops, ipython crashed. our best make stable, but...

a crash report automatically generated following information: - verbatim copy of crash traceback. - copy of input history during session. - data on current ipython configuration.

it left in file named: 'c:\users\liuzhijun_ipython\ipython_crash_report.txt' if can email file developers, information in them in understanding , correcting problem.

you can mail to: fernando perez @ fperez.net@gmail.com subject 'ipython crash report'.

if want now, following command work (under unix): mail -s 'ipython crash report' fperez.net@gmail.com < c:\users\liuzhijun_ipython\ipython_crash_report.txt

to ensure accurate tracking of issue, please file report at: https://bugs.launchpad.net/ipython/+filebug

press enter exit:

system env:windows8


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -