2016-01-23 60 views
1

我目前的python版本是2.7.10,Django的版本是1.9.1,path.py是8.1.2,但每次我試圖通過命令調用python shell時: $ python manage.py shell我收到很多錯誤和他們的結局看起來像:爲什麼在嘗試調用Django Python shell時出錯?

Error in sys.excepthook: 
Traceback (most recent call last): 
    File "W:\SVN\vendors\python\win32\lib\site-packages\IPython\CrashHandler.py", line 157, in __call__ 
    report.write(self.make_report(traceback)) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\IPython\CrashHandler.py", line 215, in make_report 
    rpt_add('BZR revision : %s \n\n' % Release.revision) 
AttributeError: 'module' object has no attribute 'revision' 

Original exception was: 
Traceback (most recent call last): 
    File "manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line 
    utility.execute() 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\__init__.py", line 345, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\base.py", line 348, in run_from_argv 
    self.execute(*args, **cmd_options) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\base.py", line 399, in execute 
    output = self.handle(*args, **options) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\commands\shell.py", line 69, in handle 
    self.run_shell(shell=options['interface']) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\commands\shell.py", line 58, in run_shell 
    return getattr(self, shell)() 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\commands\shell.py", line 41, in ipython 
    ip() 
    File "W:\SVN\vendors\python\win32\lib\site-packages\django\core\management\commands\shell.py", line 22, in _ipython_pre_011 
    shell = IPShell(argv=[]) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\IPython\Shell.py", line 73, in __init__ 
    debug=debug,shell_class=shell_class) 
    File "W:\SVN\vendors\python\win32\lib\site-packages\IPython\ipmaker.py", line 521, in make_IPython 
    IP.pre_config_initialization() 
    File "W:\SVN\vendors\python\win32\lib\site-packages\IPython\iplib.py", line 835, in pre_config_initialization 
    self.db = pickleshare.PickleShareDB(rc.ipythondir + "/db") 
    File "W:\SVN\vendors\python\win32\lib\site-packages\IPython\Extensions\pickleshare.py", line 53, in __init__ 
    if not self.root.isdir(): 
TypeError: _isdir() takes exactly 1 argument (0 given) 

我該如何克服這個問題?

回答

0

從快速搜索中看,當Django和IPython都安裝時,會發生這樣的錯誤,因爲顯然Django會嘗試使用IPython shell。

與某人的第一資源誰也有類似的問題:

run python manage.py shell occurs errors

而在上面的鏈接,在OP的問題意見的一個建議要答案這個單獨的線程:

https://superuser.com/questions/318655/error-running-ipython3-on-xp-typeerror-isdir-takes-exactly-1-argument-0-gi



獲獎回答說以下內容:

最後決定這給另一個刺,並設法得到它 工作。解決的辦法是在 IPython中-0.11 py3.2.egg \ IPython的\ utils的\ pickleshare.py文件,52行兩行的變化:

前:

if not self.root.isdir(): 
    self.root.makedirs() 

後:

if not os.path.isdir(self.root): 
     os.makedirs(self.root) 
+0

是的!這是解決方案! 謝謝你的幫助! – kLateralus

相關問題