bukzor / RefactorLib

A library for refactorization. (cheetah and python, currently)
5 stars 2 forks source link

Python parser breaks when a file doesn't have a newline #6

Open telaviv opened 10 years ago

telaviv commented 10 years ago
Traceback (most recent call last):
  File "/nail/home/skrisman/venv/refactorlib/bin/xmlfrom", line 9, in <module>
    load_entry_point('refactorlib==0.4.a', 'console_scripts', 'xmlfrom')()
  File "/nail/home/skrisman/opt/RefactorLib/refactorlib/cli/xmlfrom.py", line 22, in cli
    return main(argv, stdout)
  File "/nail/home/skrisman/opt/RefactorLib/refactorlib/cli/xmlfrom.py", line 17, in main
    stdout.write(xmlfrom(argv[1]))
  File "/nail/home/skrisman/opt/RefactorLib/refactorlib/cli/xmlfrom.py", line 10, in xmlfrom
    tree = parse(filename).getroottree()
  File "/nail/home/skrisman/opt/RefactorLib/refactorlib/parse.py", line 18, in parse
    return filetype.parser(source, encoding)
  File "/nail/home/skrisman/opt/RefactorLib/refactorlib/python/parse.py", line 24, in parse
    lib2to3_python = lib2to3_parse(python_contents)
  File "/nail/home/skrisman/opt/RefactorLib/refactorlib/python/parse.py", line 35, in lib2to3_parse
    tree = drv.parse_string(python_contents, True)
  File "/usr/lib64/python2.6/lib2to3/pgen2/driver.py", line 105, in parse_string
    return self.parse_tokens(tokens, debug)
  File "/usr/lib64/python2.6/lib2to3/pgen2/driver.py", line 70, in parse_tokens
    if p.addtoken(type, value, (prefix, start)):
  File "/usr/lib64/python2.6/lib2to3/pgen2/parse.py", line 159, in addtoken
    raise ParseError("bad input", type, value, context)
lib2to3.pgen2.parse.ParseError: bad input: type=0, value='', context=('\n', (3, 0))