This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Idle 3.8.5 on Win64 won't save a file if it didn't include a newline when it was opened (ex: opening empty file)
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.8
process
Status: closed Resolution: fixed
Dependencies: Superseder: IDLE: edit/save files created by Windows Explorer
View: 41373
Assigned To: terry.reedy Nosy List: dcrespo3d, epaine, terry.reedy
Priority: normal Keywords:

Created on 2020-09-02 11:27 by dcrespo3d, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (4)
msg376228 - (view) Author: David Crespo (dcrespo3d) Date: 2020-09-02 11:27
Idle won't save a file if it didn't include a newline when it was opened (ex: opening empty file)

Steps for reproducing the error:
1) get into some folder in Windows File Explorer
2) right-click on empty space for context menu
3) click new -> create text file
4) rename to test.py
5) right click on test.py for context menu
6) click Edit with Idle -> Edit with Idle 3.8 64-bit
7) write some code, ex: print('hello, world!)
8) try to save the file with CTRL+S, or menu file->save, file->save as or file->save a copy

IDLE will silently refuse to save the file, the 'not saved' asterisk will remain next to the file name and no file is written.

I am using a workaround for this since creating empty files and editing them is part of my usual workflow.

If I edit the file with another text editor, save it, and then open it from the context menu, it can be saved after editing, but ONLY if i put a newline in the file from the alternate text editor. If my the file does NOT contain any newline at opening time, IDLE refuses to save it.

This error (refusing to save) seems to happen also when opening from menu file->open any file which does NOT contain any newline.

Regards.
msg376233 - (view) Author: E. Paine (epaine) * Date: 2020-09-02 12:50
Thank you for reporting this bug (particularly for the detailed instructions for reproduction). This has already been fixed in #41373 just over a month ago, and is already available in the 3.9 release candidate (though the fix will not be released for 3.8 until 3.8.6).
msg376243 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020-09-02 14:40
For future reference, bpo has a search function.  Searching with component = IDLE and status = Closed or Don't care would have found this.
msg376245 - (view) Author: David Crespo (dcrespo3d) Date: 2020-09-02 14:47
Thanks for your answers. I tried to search if the bug was already reported using some text searches but I couldn't find it so I opened a new one. Next time I'll try what you recommend.

Regards and thanks for keeping Python in good shape!
History
Date User Action Args
2022-04-11 14:59:35adminsetgithub: 85857
2020-09-02 14:47:41dcrespo3dsetmessages: + msg376245
2020-09-02 14:40:10terry.reedysetstatus: open -> closed
superseder: IDLE: edit/save files created by Windows Explorer
messages: + msg376243

resolution: fixed
stage: resolved
2020-09-02 12:50:37epainesetnosy: + epaine
messages: + msg376233
2020-09-02 11:27:58dcrespo3dcreate