[pywin32-bugs] [ pywin32-Bugs-3137807 ] Pythonwin can't open a file with # -*- encoding: binary -*-
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2010-12-15 23:40:50
|
Bugs item #3137807, was opened at 2010-12-15 11:13 Message generated for change (Comment added) made by ghazel You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3137807&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: pythonwin Group: None Status: Open Resolution: Wont Fix Priority: 5 Private: No Submitted By: Greg Hazel (ghazel) Assigned to: Nobody/Anonymous (nobody) Summary: Pythonwin can't open a file with # -*- encoding: binary -*- Initial Comment: If a file starts with "# -*- encoding: binary -*-", Pythonwin cannot seem to open it. ---------------------------------------------------------------------- >Comment By: Greg Hazel (ghazel) Date: 2010-12-15 23:40 Message: Well, I'm not the original author of any files I've encountered with this preamble, so I can't say why it was chosen, nor can I use something different to start with. However, I believe the author's intention, and certainly a reasonable approach, would be to treat binary encoding like 8bit ascii, which I assume is the same as you would treat it if there was no encoding specified at all. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2010-12-15 23:24 Message: Hrm - pep 263 which defines this behaviour says the encoding must be "known" and my tests demonstrate python itself refuses to work with such files. It is hard to justify a special case for the string "binary" - can't you just use latin-1 or similar to achieve the same result? The issue is pythonwin uses that encoding to determine how to translate the bytes into characters... ---------------------------------------------------------------------- Comment By: Greg Hazel (ghazel) Date: 2010-12-15 21:49 Message: I have run in to this with several source files, which were some reason marked with that preamble but otherwise perfectly editable. Also, I can open notepad.exe in pythonwin just fine. I'm not expecting pythonwin to work miracles and let me edit binary data correctly, I just think it should let me open files no matter what they say at the beginning (like notepad.exe opens just fine). Otherwise, I have to open the file with Wordpad, strip the preamble, then open with Pythonwin (and remember to put it back later). Very troublesome. ---------------------------------------------------------------------- Comment By: Mark Hammond (mhammond) Date: 2010-12-15 19:43 Message: pythonwin only supports editing text and without a text based encoding it can't do much. If the problem is that the error message is unclear I can look at fixing that, but will not enable actual editing of the file. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=3137807&group_id=78018 |