开发者

Python IDLE freezes

This is absolutely frustrating, but I am not sure if the following is an issue only on my machine or with IDLE in general.

When attempting to print a long list in the shell, and that could happen by accident while debugging, the program crushes and you have to restart it manually.

Even worse, if you have a few editor windows open, it always spawns a few sub-processes, and each of these has to be manually shut down from the task manager.

Is t开发者_JS百科here any way to avoid that?

I am using Python 3, by the way.


The Squeezer extension addresses this problem. Instead of displaying the long text (which is the source of the slow-down), Squeezer captures the output and displays a button instead. You have the option of expanding the contents or viewing it in Notepad.

Squeezer is included in IdleX, which you may find useful.


It seems tk needs to write a lot of data in the shell frame, this takes a lot of time and when the list is long then it becomes unresponsive.

I did:

>>a = range(n)
>>print(list(a))

It was OK for n = 100 or n = 1000. After that point things started being slow. For n as low as 10000, moving the page up and down becomes very, very slow.

I suspect that there is no solution. For small values of n probably it would help to clear() the window but unfortunately idle have not implemented any method to clear the shell. I dont understand why because it should not be difficult...

Edit 2012: During the last months IDLE behavior and functionality got many important improvements through the collection of extensions and plugins provided by IdleX .
Accidental printing of high amounts of data is not a problem anymore. When IdleX detects such a situation it shows a warning indicating the existence of the data instead of printing it. Righ-clicking on the warning produces a preview of the data, not in idle shell but on the system text editor (notepad in windows). In this way the shell doesnt get cluttered with data nor slow down.

Python IDLE freezes

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜