非常简单的程序崩溃Python 3.5和spyder(Very Simple Program Crashing Python 3.5 and spyder)

编程入门 行业动态 更新时间:2024-10-12 18:22:46
非常简单的程序崩溃Python 3.5和spyder(Very Simple Program Crashing Python 3.5 and spyder) xx = 0 n = 4294967295 while xx <= n: print("xx = ", xx, bin(xx)) xx += 1

这导致以下回溯:

File "<ipython-input-2-0c9d04ddbbc6>", line 1, in <module> runfile('C:/Users/Allen/Documents/Python Scripts/crunchy.py', wdir='C:/Users/Allen/Documents/Python Scripts') File "C:\Users\Allen\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "C:\Users\Allen\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "C:/Users/Allen/Documents/Python Scripts/crunchy.py", line 11, in <module> print("xx = ", xx, bin(xx)) File "C:\Users\Allen\Anaconda3\lib\site-packages\ipykernel\iostream.py", line 317, in write self._buffer.write(string) ValueError: I/O operation on closed file xx = 0 n = 4294967295 while xx <= n: print("xx = ", xx, bin(xx)) xx += 1

This results in the following traceback:

File "<ipython-input-2-0c9d04ddbbc6>", line 1, in <module> runfile('C:/Users/Allen/Documents/Python Scripts/crunchy.py', wdir='C:/Users/Allen/Documents/Python Scripts') File "C:\Users\Allen\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile execfile(filename, namespace) File "C:\Users\Allen\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "C:/Users/Allen/Documents/Python Scripts/crunchy.py", line 11, in <module> print("xx = ", xx, bin(xx)) File "C:\Users\Allen\Anaconda3\lib\site-packages\ipykernel\iostream.py", line 317, in write self._buffer.write(string) ValueError: I/O operation on closed file

最满意答案

看来你正在使用ipython。

根据这个页面: https : //github.com/ipython/ipython/issues/9168

您可能会遇到一个已知问题,并将在下一个版本中修复。 顺便说一句,当我在终端中运行它时,该程序不会崩溃。

It seems that you are using ipython.

According to this page: https://github.com/ipython/ipython/issues/9168

you might run into a know issue and will be fixed in the next release. By the way, that program does not crash when I am running it in terminal.

更多推荐

本文发布于:2023-07-06 07:41:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047434.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:简单   程序   Python   Crashing   Program

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!