简体   繁体   中英

Python IDLE is refusing to save and is the crashing when I try to save a file with a specific comment

I am running Python 2.7. I wrote some code in the IDLE. I found that it would not save the file. If I repeatedly try to save, IDLE just crashes completely. I found that if I removed the following comment, it would save:

#Add a fourth parameter, end, to the find function that specifies where to stop looking. Warning: This exercise is a bit tricky. The default value of end should be len(str), but that doesn't work. The default values are evaluated when the function is defined, not when it is called. When find is defined, str doesn't exist yet, so you can’t find its length.

Oddly, I found if I truncated the comment to the following, it can save:

#Add a fourth parameter, end, to the find function that specifies where to stop looking. Warning: This exercise is a bit tricky. The default value of end should be len(str), but that doesn

It does not seem to be the length of the comment, as this version, where the comment is split into two, also does not save:

#Add a fourth parameter, end, to the find function that specifies where to stop looking. Warning: This exercise is a bit tricky. The default value of end should be len(str), but that doesn
#’t work. The default values are evaluated when the function is defined, not when it is called. When find is defined, str doesn’t exist yet, so you can’t find its length.

I imagine there is some rule for comments that I don't know, so any insight would be much appreciated.

您必须进入选项 - >配置IDLE - >常规并将默认源编码设置为UTF-8选项。

Try again after Restarting your computer.

If not-resolved Try visiting

https://bugs.python.org/issue14996

I have exactly the same problem as you do. I found that apparently IDLE overloads or some sort after you type in more than 10 characters and save. I try to save Ctrl+S every time i write a word, that seems to be the only way it is able to save. If you find any other way to fix the problem be sure to notify!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM