[pywin32-bugs] [ pywin32-Bugs-1520060 ] .py file "IndentationError" corrupts appearance
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2008-02-19 01:39:13
|
Bugs item #1520060, was opened at 2006-07-10 11:21 Message generated for change (Comment added) made by rupole You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1520060&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: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Mark E (markenglish) Assigned to: Nobody/Anonymous (nobody) Summary: .py file "IndentationError" corrupts appearance Initial Comment: Opening a .py file like the one attached causes a long stack trace to appear in the Interactive Window (appended at base of this description), and a number of strange characters to appear in the script window (particularly breakpoint characters on every line). The file must have triple quotes at the top, some kind of code construct like a class or a file with a triple- quoted doc string who's second line is indented. For example: ---Start--- """ """ def foo(): """This line is fine This line makes PythonWin unhappy. """ pass ---End--- Removing the triple quotes from the top of the file makes the problem vanish. Removing the second line from the function doc-string also makes the problem vanish. Tried on Windows 2000 installation built from source, and Windows XP SP2 installation installed from ActiveState. ---Error Log--- >>> Traceback (most recent call last): File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\framework\editor\color\colored itor.py", line 51, in OnInitialUpdate SyntEditViewParent.OnInitialUpdate(self) File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\scintilla\view.py", line 210, in OnInitialUpdate self.OnWinIniChange(None) File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\scintilla\view.py", line 223, in OnWinIniChange self.DoConfigChange() File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\framework\editor\color\colored itor.py", line 162, in DoConfigChange ext.set_indentation_params(1) File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\idle\AutoIndent.py", line 140, in set_indentation_params i = self.guess_indent() File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\idle\AutoIndent.py", line 473, in guess_indent opener, indented = IndentSearcher(self.text, self.tabwidth).run() File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\idle\AutoIndent.py", line 546, in run _tokenize.tokenize(self.readline, self.tokeneater) File "C:\Program Files\Python242\Lib\tokenize.py", line 153, in tokenize tokenize_loop(readline, tokeneater) File "C:\Program Files\Python242\Lib\tokenize.py", line 159, in tokenize_loop for token_info in generate_tokens(readline): File "C:\Program Files\Python242\Lib\tokenize.py", line 229, in generate_tokens raise IndentationError( IndentationError: unindent does not match any outer indentation level for line: """ win32ui: OnInitialUpdate() virtual handler (<bound method SyntEditView.OnInitialUpdate of <pywin.framework.editor.color.coloreditor.SyntEditView instance at 0x010F4DA0>>) raised an exception Traceback (most recent call last): File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\framework\editor\color\colored itor.py", line 51, in OnInitialUpdate SyntEditViewParent.OnInitialUpdate(self) File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\scintilla\view.py", line 210, in OnInitialUpdate self.OnWinIniChange(None) File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\scintilla\view.py", line 223, in OnWinIniChange self.DoConfigChange() File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\framework\editor\color\colored itor.py", line 162, in DoConfigChange ext.set_indentation_params(1) File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\idle\AutoIndent.py", line 140, in set_indentation_params i = self.guess_indent() File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\idle\AutoIndent.py", line 473, in guess_indent opener, indented = IndentSearcher(self.text, self.tabwidth).run() File "C:\Program Files\Python24\Lib\site- packages\pythonwin\pywin\idle\AutoIndent.py", line 546, in run _tokenize.tokenize(self.readline, self.tokeneater) File "C:\Program Files\Python242\Lib\tokenize.py", line 153, in tokenize tokenize_loop(readline, tokeneater) File "C:\Program Files\Python242\Lib\tokenize.py", line 159, in tokenize_loop for token_info in generate_tokens(readline): File "C:\Program Files\Python242\Lib\tokenize.py", line 229, in generate_tokens raise IndentationError( IndentationError: unindent does not match any outer indentation level for line: """ win32ui: OnInitialUpdate() virtual handler (<bound method SyntEditView.OnInitialUpdate of <pywin.framework.editor.color.coloreditor.SyntEditView instance at 0x010F4EB8>>) raised an exception ---------------------------------------------------------------------- >Comment By: Roger Upole (rupole) Date: 2008-02-18 20:39 Message: Logged In: YES user_id=771074 Originator: NO This no longer occurs with recent builds. Not sure at what point it was fixed, though. ---------------------------------------------------------------------- Comment By: Mark E (markenglish) Date: 2006-07-10 11:29 Message: Logged In: YES user_id=1174185 To see the problem save a file with the code, then re-open it. ---------------------------------------------------------------------- Comment By: Mark E (markenglish) Date: 2006-07-10 11:28 Message: Logged In: YES user_id=1174185 To see the problem save a file with the code, then re-open it. ---------------------------------------------------------------------- Comment By: Mark E (markenglish) Date: 2006-07-10 11:27 Message: Logged In: YES user_id=1174185 Apparently follow-up posts get to keep indentation, so here's hoping: ---Start--- """ """ def foo(): """This line is fine This line makes PythonWin unhappy. """ pass ---End--- ---------------------------------------------------------------------- Comment By: Mark E (markenglish) Date: 2006-07-10 11:23 Message: Logged In: YES user_id=1174185 Unfortunately the code loses indentation inline in the report, so use the attached indnterr.py file to see the problem ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=1520060&group_id=78018 |