IDLE 3.8.4 and 3.9.0b4 won't save files with non-ascii characters

夙愿已清 提交于 2021-01-22 06:50:41

问题


Edit : adding "import io" in iomenu.py fixed the problem indeed. Thanks a lot Terry!

Original: Like the title said : I'm using IDLE (Windows) to write scripts in python, but it won't save (ctrl+s, manual save, or the save at exit). It doesn't freeze or crash, it just doesn't save (I can tell by the * before the name of the file on the windows title). After some tries I realized that it happens only when I'm using letters with diacritics in the text (I'm French so it will be éèêàç...). As soon as I change the letters, I can save again, and therefore run the script. Notepad or the python shell still work fine.

Things that don't work :

  • putting any coding in # -*- coding: UTF-8 -*-
  • reinstalling python (done twice)
  • restarting

I started coding only ten days ago so I'm still a newb but I guess this has something to do with encoding? It might be related to the new 3.8.4 update as it worked fine until today. I'm working on Windows 10 64 bit.

Thanks!


回答1:


Either a) add import io to the top of <pythondir>/idlelib/iomenu.py, or b) get 3.8.5, released today with hot fixes to multiple problems in 3.8.4, including this one. Same answer applies to 3.9.0b4 versus 3.9.0b5, also released today.

EDIT: In 3.8.5 and 3.9.0b5 there remains another issue with respect to save failing and line endings when editing files created outside of IDLE. iomenu.py, line 251, is currently

    if self.eol_convention != "\n":

Change it to

    if isinstance(self.eol_convention, str) and self.eol_convention != "\n":

EDIT 2: 3.8.6, and 3.9.0, both recently released, fix both issues.



来源:https://stackoverflow.com/questions/63000314/idle-3-8-4-and-3-9-0b4-wont-save-files-with-non-ascii-characters

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