Python - I can't see my what my error is because the window disappears immediately

筅森魡賤 提交于 2019-12-29 02:07:44

问题


I am pretty new to Python and I have been pretty annoyed with this problem. I am not sure if this matters, but I run my .py file with Python 2.7.6 with python installed on my computer, not using it on any online thing or other program. Every time I come across an error, my program works fine until it comes to the error, but the window disappears right before I can possibly read whatever the error said it was... Anyways, I haven't been able to find out what is wrong with my programming, and I am tired of guessing and guessing what is wrong. How can I extend the time so I can read the error message? Or something like that? Thanks


回答1:


Yes, as @shortfellow said, running it from the terminal should work:

python your_file.py

Another tip that helps in Python, if you are having a hard time with errors, is to use iPython for debugging/testing code on the spot. You can give it a try.

http://ipython.org/




回答2:


You should run it from command window/terminal instead of double clicking on the file.



来源:https://stackoverflow.com/questions/22830060/python-i-cant-see-my-what-my-error-is-because-the-window-disappears-immediate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!