1

I'm having some difficulty with an error I keep getting when I try to convert some python2.7 code to python3. I know this code works in python2.7. However when I try to convert it to python3 using 2to3.py I receive this error:

RefactoringTool: Can't parse ProAnalysis.py: ParseError: bad input: type=5, value='\t', context=('', (1562,0))

After searching the internet I saw that some people said that added -p would solve the problem however when I added that I only get the new error:

RefactoringTool: Can't parse ProAnalysis.py: ParseError: bad input: type=3, value="'Only using alignments greater than %.2f id and %.2f coverage'", context=('', (52,10))

I don't know if seeing the original file would help however it is a few thousand lines long. Any help would be very must appreciated. Thank you!

-Rachel

Moses Koledoye
  • 77,341
  • 8
  • 133
  • 139
Rachel
  • 11
  • 1
  • 3
  • 4
    Can you show the *section of code* that it's failing to parse/convert to Python 3 more specifically? – HEADLESS_0NE Jun 01 '16 at 18:08
  • 1
    Maybe the "RefactoringTool" error indicated a line number "1562" in the error? So if you have the permission to show the portion arround these lines to the world feel free to do so, otherwise I can only suggest, that you google for typical conversion problems from v2 to v3 and look into the source of ProAnalysis.py yourself. HTH – Dilettant Jun 01 '16 at 18:14
  • 1
    `\t` is a tab. If you have any tabs in your file, convert them to spaces. This is a good thing to do anyway. – Alex Hall Jun 01 '16 at 18:27

1 Answers1

0

The context value lists the line and column numbers, so you should check your code there (as suggested by Dilettant in the comments to the question).

Presumably you'll get a good idea of what can trip the parser of 2to3.

Eric O. Lebigot
  • 91,433
  • 48
  • 218
  • 260