[issue41378] IDLE EOL convention not set on a empty file

2020-07-23 Thread Serhiy Storchaka


Serhiy Storchaka  added the comment:

It is a duplicate of issue41373 (and the problem is not only with empty files).

--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> IDLE: edit/save files created by Windows Explorer

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41378] IDLE EOL convention not set on a empty file

2020-07-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +lukasz.langa

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41378] IDLE EOL convention not set on a empty file

2020-07-23 Thread Raymond Hettinger


Raymond Hettinger  added the comment:

This may have been caused by 
https://github.com/python/cpython/commit/c3fa7534c7173d338880a1727f17795670518610
 for https://bugs.python.org/issue41378

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41378] IDLE EOL convention not set on a empty file

2020-07-23 Thread Raymond Hettinger


Change by Raymond Hettinger :


--
nosy: +serhiy.storchaka

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41378] IDLE EOL convention not set on a empty file

2020-07-23 Thread Emmanuel Arias


Emmanuel Arias  added the comment:

Hello everybody!

When a new file is loaded, the current loadfile read for the newline to set
the eol_convention. As does not exist for a empty file a None is saved and
for that reason the exception is raised

If you consider that this patch is correct I cant submit a PR

Cheers

--
keywords: +patch
nosy: +eamanu
Added file: 
https://bugs.python.org/file49334/0001-Fix-eol_convention-when-file-does-not-exist.patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue41378] IDLE EOL convention not set on a empty file

2020-07-23 Thread Raymond Hettinger


New submission from Raymond Hettinger :

I think this is a new bug, present in Python 3.8.5 but not present in 3.8.3.

Steps to reproduce:

* $ touch xyzpdq.py # Creates new file, zero bytes in length
* $ python3.8 -m idlelib.idle xyzdpq.py
* Enter text:   print('hello world')
* Attempt to save the file with Cmd-S
* This seems to be unrecoverable and results
  in losing all the code that was entered.

 example session ---
~ $ cd tmp
~/tmp $ touch qwerty.py
~/tmp $ python3.8 -m idlelib.idle qwerty.py
Exception in Tkinter callback
Traceback (most recent call last):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/tkinter/__init__.py",
 line 1883, in __call__
return self.func(*args)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/multicall.py",
 line 176, in handler
r = l[i](event)
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/iomenu.py",
 line 200, in save
if self.writefile(self.filename):
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/iomenu.py",
 line 232, in writefile
text = self.fixnewlines()
  File 
"/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/idlelib/iomenu.py",
 line 252, in fixnewlines
text = text.replace("\n", self.eol_convention)
TypeError: replace() argument 2 must be str, not None

--
assignee: terry.reedy
components: IDLE
keywords: 3.8regression, 3.9regression
messages: 374155
nosy: rhettinger, terry.reedy
priority: high
severity: normal
status: open
title: IDLE EOL convention not set on a empty file
type: crash
versions: Python 3.10, Python 3.8, Python 3.9

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com