Open alwilson opened 4 years ago
As a workaround, it appears that importing print_function from future helps 2to3. I'm not sure what the right fix is here though. Perhaps pyannotate can prepend python3 files with this import to bypass issues with lib2to3?
from __future__ import print_function
Haha, well, disregard all of this. The -p or --print-function appears to do exactly what I wanted. Maybe there could be a warning or suggestion on using the print function? It is right in the help though, so...
I'm running into issues with applying generated annotations to my Python3 snippet. I narrowed down my issue to keyword args(sep='' or end='') passed to print statements. After some debugging I learned that pyannotate is using 2to3 to refactor the code. It looks like 2to3 scans for certain python3 features and then fails to parse the entire file if it finds an instance.
Also, great tool! I'm excited to make use of this. It's worked very well on files without keyword args in print.
example.py:
Applying annotations to example.py:
Version info:
Exception stack trace (from PyCharm):