[Python-bugs-list] [ python-Bugs-545600 ] IDLE doesn't save 8bit files
noreply@sourceforge.net
noreply@sourceforge.net
Tue, 13 Aug 2002 23:57:33 -0700
Bugs item #545600, was opened at 2002-04-18 13:28
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=545600&group_id=5470
Category: IDLE
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Alexandre Fayolle (afayolle)
>Assigned to: Martin v. Löwis (loewis)
Summary: IDLE doesn't save 8bit files
Initial Comment:
This bug seems to be related to #527022.
Short version is: IDLE won't save files containing 8bit
characters (for instance in comments or in litteral
strings). No error dialog is displayed, only a
traceback on stderr or in the interactive window if
it's available:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python2.1/lib-tk/Tkinter.py", line
1285, in __call__
return apply(self.func, args)
File "/usr/lib/idle-python2.1/IOBinding.py", line
126, in save
self.save_as(event)
File "/usr/lib/idle-python2.1/IOBinding.py", line
136, in save_as
if self.writefile(filename):
File "/usr/lib/idle-python2.1/IOBinding.py", line
154, in writefile
f.write(chars)
UnicodeError: ASCII encoding error: ordinal not in
range(128)
Possible solution:
* at least warn the user that the file could not be
saved with an error dialog
* try using the locale to guess the encoding and do
appropriate conversions
* ask the user wich encoding should be used to save
the file
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-08-14 08:56
Message:
Logged In: YES
user_id=21627
Please try CVS IDLE. It corrects these problems.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2002-08-14 00:21
Message:
Logged In: NO
Also, the file gets destroyed - truncated to 0 bytes, after
such unsucessful save.
----------------------------------------------------------------------
Comment By: Alexandre Fayolle (afayolle)
Date: 2002-04-19 11:30
Message:
Logged In: YES
user_id=116727
I like the solution proposed in the reference.
However, having just a traceback printed on the console
looks like a bug to me. I expect IDLE to complain loudly in
case it cannot save my file. If it could give me a hint as
to what to add to the file to be able to save it, that'd be
even better.
Cheers
Alexandre
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2002-04-19 10:23
Message:
Logged In: YES
user_id=21627
In this form, this is not a bug. IDLE cannot know what
encoding you want to use the file.
Under PEP 263, you will need to declare the encoding inside
the file; then IDLE will use the declared encoding. See
http://sourceforge.net/tracker/index.php?func=detail&aid=508973&group_id=9579&atid=309579
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=545600&group_id=5470