各位前輩好,我正在學習用Python(Django)寫網站。
目前碰到的問題,我自己有試著找方法,但問題還沒解決。
還在努力嘗試中,也希望能夠有高手給予指點。
在cmd中下了python manage.py shell的指令,遇到錯誤訊息如下(本文最下方附上完整錯誤訊息):
prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
我的電腦系統是Windows10 64-bit operating system, x64-based processor
Python版本是3.4.1
IPython版本是6.5.0
有嘗試自己在網路上尋找解決方法,找到有人提出相似的問題#9921,而也有人在#10070提供解方,Django的開發者已經依據自己這篇內提供的解方更改了程式碼。所以我的"\lib\site-packages\prompt_toolkit\terminal\win32_output.py"檔案,已經是長這樣了:
def get_win32_screen_buffer_info(self):
self.flush()
sbinfo = CONSOLE_SCREEN_BUFFER_INFO()
success = windll.kernel32.GetConsoleScreenBufferInfo(self.hconsole, byref(sbinfo))
if success:
return sbinfo
else:
raise NoConsoleScreenBufferError
以下附上完整的錯誤訊息。
(djangogirls_venv) D:\W20180429\DjangoGirls\mysite>python manage.py shell
D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\db\backends\sqlite3\base.py:57: RuntimeWarning: SQLite received a naive datetime (2018-08-01 22:09:22.523032) while time zone support is active.
RuntimeWarning)
Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 10:45:13) [MSC v.1600 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.5.0 -- An enhanced Interactive Python. Type '?' for help.
Traceback (most recent call last):
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\interface.py", line 413, in run
self._redraw()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\interface.py", line 358, in _redraw
self.renderer.render(self, self.layout, is_done=self.is_done)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\renderer.py", line 450, in render
previous_width=(self._last_size.columns if self._last_size else 0))
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\renderer.py", line 128, in _output_screen_diff
output.erase_down()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 193, in erase_down
sbinfo = self.get_win32_screen_buffer_info()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 172, in get_win32_screen_buffer_info
raise NoConsoleScreenBufferError
prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\__init__.py", line 354, in execute_from_command_line
utility.execute()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\__init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\base.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\base.py", line 445, in execute
output = self.handle(*args, **options)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\commands\shell.py", line 69, in handle
self.run_shell(shell=options['interface'])
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\commands\shell.py", line 58, in run_shell
return getattr(self, shell)()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\commands\shell.py", line 41, in ipython
ip()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\core\management\commands\shell.py", line 35, in _ipython
start_ipython(argv=[])
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\IPython\__init__.py", line 125, in start_ipython
return launch_new_instance(argv=argv, **kwargs)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\IPython\terminal\ipapp.py", line 356, in start
self.shell.mainloop()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\IPython\terminal\interactiveshell.py", line 485, in mainloop
self.interact()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\IPython\terminal\interactiveshell.py", line 468, in interact
code = self.prompt_for_code()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\IPython\terminal\interactiveshell.py", line 381, in prompt_for_code
pre_run=self.pre_prompt, reset_current_buffer=True)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\interface.py", line 425, in run
self._redraw()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\interface.py", line 358, in _redraw
self.renderer.render(self, self.layout, is_done=self.is_done)
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\renderer.py", line 450, in render
previous_width=(self._last_size.columns if self._last_size else 0))
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\renderer.py", line 128, in _output_screen_diff
output.erase_down()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 193, in erase_down
sbinfo = self.get_win32_screen_buffer_info()
File "D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\prompt_toolkit\terminal\win32_output.py", line 172, in get_win32_screen_buffer_info
raise NoConsoleScreenBufferError
prompt_toolkit.terminal.win32_output.NoConsoleScreenBufferError: No Windows console found. Are you running cmd.exe?
If you suspect this is an IPython bug, please report it at:
https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org
You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.
Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
%config Application.verbose_crash=True
D:\W20180429\DjangoGirls\djangogirls_venv\lib\site-packages\django\db\backends\sqlite3\base.py:57: RuntimeWarning: SQLite received a naive datetime (2018-08-01 22:09:23.158289) while time zone support is active.
RuntimeWarning)
若還遺漏了什麼重要資訊還沒提供,請不吝賜教、提醒。謝謝各位!