Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Bugs

[issue14929] IDLE crashes on *Edit / Find in files ...* command

 

 

Python bugs RSS feed   Index | Next | Previous | View Threaded


report at bugs

May 27, 2012, 2:38 PM

Post #1 of 6 (84 views)
Permalink
[issue14929] IDLE crashes on *Edit / Find in files ...* command

Roger Serwy <roger.serwy [at] gmail> added the comment:

When running IDLE from the terminal on Ubuntu, I get the following error:

Exception in Tkinter callback
Traceback (most recent call last):
File "/home/serwy/python/cpython/Lib/tkinter/__init__.py", line 1442, in __call__
return self.func(*args)
File "./idlelib/GrepDialog.py", line 70, in default_command
self.grep_it(prog, path)
File "./idlelib/GrepDialog.py", line 90, in grep_it
block = f.readlines(100000)
File "/home/serwy/python/cpython/Lib/codecs.py", line 300, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe4 in position 120: invalid continuation byte

The reason why IDLE closes suddenly on Windows is described in issue13582.

----------
nosy: +serwy, terry.reedy
title: IDLE crashes on *Edit / Find in files ...* command (Python 3.2, Windows XP) -> IDLE crashes on *Edit / Find in files ...* command
type: -> behavior

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 27, 2012, 3:27 PM

Post #2 of 6 (84 views)
Permalink
[issue14929] IDLE crashes on *Edit / Find in files ...* command [In reply to]

Roger Serwy <roger.serwy [at] gmail> added the comment:

The GrepDialog opens a file using plain "open", without specifying the encoding or how to handle errors. The docs for "open" says that "the default encoding is platform dependent (whatever locale.getpreferredencoding() returns)..." This can be problematic, as files can have different encodings and GrepDialog at present has no way to detect file encodings.

Attached is a preliminary patch to replace code points if the default decoder encounters errors.

----------
keywords: +patch
Added file: http://bugs.python.org/file25740/prelim_14929.patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 27, 2012, 8:06 PM

Post #3 of 6 (80 views)
Permalink
[issue14929] IDLE crashes on *Edit / Find in files ...* command [In reply to]

Roundup Robot <devnull [at] psf> added the comment:

New changeset 12454f78967b by Terry Jan Reedy in branch '3.2':
Issue14929: Stop Idle 3.x from closing on Unicode decode errors when grepping.
http://hg.python.org/cpython/rev/12454f78967b

New changeset 058c3099e82d by Terry Jan Reedy in branch 'default':
Merge 3.2 #14929
http://hg.python.org/cpython/rev/058c3099e82d

----------
nosy: +python-dev

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 27, 2012, 8:08 PM

Post #4 of 6 (80 views)
Permalink
[issue14929] IDLE crashes on *Edit / Find in files ...* command [In reply to]

Terry J. Reedy <tjreedy [at] udel> added the comment:

Interesting -- and nasty. I have used this successfully with both 3.2 and now 3.3 on Win7 to search idlelib/*.py files and on a directory of my own files, all written by Idle and been quite pleased with the speed.

I just tried searching /Lib/*.py for 'itertools' and quickly got 10 results (up to decimal.py) before Idle disappeared. OK, import idlelib/idle in console, repeat, and I get the same traceback up to

File "C:\Programs\Python33\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 1877: character maps to <undefined>

This is not a problem on 2.7.

Patch fixes problem, so I committed it so it will be in 3.3.0a4 (in a few days).

The default extension is .py. The default encoding for .py files is utf-8. I think that is the default for what Idle writes. So I think this should be the default encoding (explicitly given) at least for .py files.

----------
assignee: -> terry.reedy
versions: +Python 3.3

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

May 27, 2012, 8:13 PM

Post #5 of 6 (80 views)
Permalink
[issue14929] IDLE crashes on *Edit / Find in files ...* command [In reply to]

Terry J. Reedy <tjreedy [at] udel> added the comment:

Hit send too soon;-). With that much done, we can think about a more complete fix. See last paragraph above. Also, perhaps dialog box could have encodings field. People should be able to grep python code for any legal identifier, and this means proper decoding according to the encoding they actually use.

Francisco, thanks for reporting this, and Roger, thanks for quick fix.

----------
stage: -> needs patch

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com


report at bugs

Jun 3, 2012, 5:07 AM

Post #6 of 6 (72 views)
Permalink
[issue14929] IDLE crashes on *Edit / Find in files ...* command [In reply to]

Francisco Gracia <fgragu023 [at] gmail> added the comment:

While your are at it, here is another suggestion: what the *Find in files ...* dialog needs most urgently in my opinion is a field for specifying clearly the directory from which the user wants to launch the search.

Also in my modest opinion, having an input field for encondings would be good, although detecting the encodings of the handled files is something that any self respecting software should reliably do by itself.

----------

_______________________________________
Python tracker <report [at] bugs>
<http://bugs.python.org/issue14929>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/list-python-bugs%40lists.gossamer-threads.com

Python bugs RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.