Hi,

* Maximiliano Curia <m...@debian.org> [2017-03-30 11:23]:
¡Hola Andrew!

El 2017-02-22 a las 11:19 +0100, Andrew Shadura escribió:
Package: decopy Version: 0.2-1 Severity: important

I'm trying to use decopy on a Python 2 package, and it fails, as it seems it attempts to parse its Python code with Python 3 parser:

I was cutting some corners by using the tokenize module, I should have written a small tokenizer that only handles comments and doc strings, this is still pending.

$ decopy Traceback (most recent call last):
File "/usr/bin/decopy", line 11, in <module>
load_entry_point('Decopy==0.1', 'console_scripts', 'decopy')() File "/usr/lib/python3/dist-packages/decopy/decopy.py", line 62, in main filetree.process(options) File "/usr/lib/python3/dist-packages/decopy/tree.py", line 369, in process item.process_licenses(self.root, options) File "/usr/lib/python3/dist-packages/decopy/tree.py", line 175, in process_licenses copyrights, licenses = parse_file(fullpath, options) File "/usr/lib/python3/dist-packages/decopy/parsers.py", line 155, in parse_file copyrights, licenses = parser(fullname) File "/usr/lib/python3/dist-packages/decopy/parsers.py", line 62, in python_parser for token in tokenize.tokenize(f.readline): File "/usr/lib/python3.5/tokenize.py", line 580, in _tokenize ("<tokenize>", lnum, pos, line)) File "<tokenize>", line 176 print "SSRC spammer started" ^ IndentationError: Missing parentheses in call to 'print'

I was trying to write a test case about this and it seems that the py2 code needs to be invalid to get this error, but it's only yield when trying to run it.

Apparently, when running python 2 code in python 3 a:
python "Foo"
yields a SyntaxError exception with the Missing parentheses in call to 'print' message, and:
for a in []:
print "Bar"
yields the reported IndentationError exception.

But I could not get these exceptions when using the tokenize module.

If you can still reproduce this issue, I would like to write a test with the file that's failling, so, if possible, please let me know how can I access the src tree that's producing this issue in decopy.

Based on the string I guess it is this file:

https://mau.dev/maunium/synapse/-/blob/v0.5.4/contrib/jitsimeetbridge/jitsimeetbridge.py#L176

But I can't reproduce the bug with a recent decopy either.

I guess this could be closed but will leave the decision to you.

Cheers Jochen

Attachment: signature.asc
Description: PGP signature

Reply via email to