thegooglecodearchive / editra-plugins

Automatically exported from code.google.com/p/editra-plugins
0 stars 1 forks source link

Syntax errors not marked if python3 binary is selected #219

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What Plugin does this relate to? What version of the Plugin?
PyStudio

What steps will reproduce the problem?
1. Set the python binary to /usr/bin/python3, and enable marking syntax errors 
on save.
2. Add some nonsense characters -- eg ":4Pfp30952+40zed~@^" to an existing .py 
file
3. Save the file. 
(this is true no matter what kind of syntax error it is.)

I expect to see the line containing nonsense marked; but it is not marked.
(note: it is correctly marked if /usr/bin/python2 is the selected binary 
instead)

I'm using Editra 0.7.12 on Arch Linux x86_64. PyStudio installed as of 
yesterday.

I've compared the output produced by invoking python2 and python3 on nonsense. 
It is character for character identical (ie. 'diff /tmp/py2 /tmp/py3' prints 
nothing), and the returnvalue is also the same (==1)

Original issue reported on code.google.com by 00a...@gmail.com on 12 Sep 2012 at 2:26

GoogleCodeExporter commented 9 years ago
Odd, will have to investigate but have a suspicion that Python 3 may be writing 
to a different output pipe or something.

Currently PyStudio checks stderr of the python process used to check for syntax 
errors. Maybe Python has started writing errors to stdout instead?

Original comment by CodyPrec...@gmail.com on 12 Sep 2012 at 12:59

GoogleCodeExporter commented 9 years ago
well, it isn't a matter of which pipe; they both use stderr. I had to use &> to 
redirect stderr instead of stdin in order to do the diff.

Original comment by 00a...@gmail.com on 12 Sep 2012 at 3:15

GoogleCodeExporter commented 9 years ago
Root cause:

py_compile module has changed its output reporting in python 3 parsing is 
failing to identify the error.

Python 2.x:
SyntaxError: ('invalid syntax', ('test.py', 3, 1, '*(F$\n'))

Python 3.x:
File "test.py", line 2
    print "foo"
              ^
SyntaxError: invalid syntax

Original comment by CodyPrec...@gmail.com on 13 Sep 2012 at 12:14

GoogleCodeExporter commented 9 years ago
fixed in svn for version 0.8 of PyStudio plugin

Original comment by CodyPrec...@gmail.com on 13 Sep 2012 at 1:39