Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ParseError when trying to translate a module #353

Open
AmitMY opened this issue Aug 13, 2018 · 0 comments
Open

ParseError when trying to translate a module #353

AmitMY opened this issue Aug 13, 2018 · 0 comments

Comments

@AmitMY
Copy link

AmitMY commented Aug 13, 2018

Using past to load a Python2 library, as:

from past import autotranslate
autotranslate(['chrono'])
import chrono

After installing it:

pip install git+git://github.com/wanasit/chrono-python.git

Throws this error:

Traceback (most recent call last):
File "/Users/admin/dev/deep-grammar/utils/delex.py", line 5, in
import chrono
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "/anaconda3/envs/deep-grammar/lib/python3.6/site-packages/past/translation/init.py", line 413, in load_module
exec(code, mod.dict)
File "/anaconda3/envs/deep-grammar/lib/python3.6/lib2to3/fixes/fix_itertools.py", line 1, in
""" Fixer for itertools.(imap|ifilter|izip) --> (map|filter|zip) and
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "/anaconda3/envs/deep-grammar/lib/python3.6/site-packages/past/translation/init.py", line 413, in load_module
exec(code, mod.dict)
File "/anaconda3/envs/deep-grammar/lib/python3.6/site-packages/chrono/Chrono.py", line 8, in
from parsed_result import ParsedResult
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "/anaconda3/envs/deep-grammar/lib/python3.6/site-packages/past/translation/init.py", line 413, in load_module
exec(code, mod.dict)
File "/anaconda3/envs/deep-grammar/lib/python3.6/site-packages/chrono/options.py", line 7, in
from parsers.en import ENMonthNameMiddleEndianParser
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "/anaconda3/envs/deep-grammar/lib/python3.6/site-packages/past/translation/init.py", line 396, in load_module
if detect_python2(source, self.pathname):
File "/anaconda3/envs/deep-grammar/lib/python3.6/site-packages/past/translation/init.py", line 213, in detect_python2
tree = RTs._rt_py2_detect.refactor_string(source, pathname)
File "/anaconda3/envs/deep-grammar/lib/python3.6/lib2to3/refactor.py", line 377, in refactor_string
name, err.class.name, err)
File "/anaconda3/envs/deep-grammar/lib/python3.6/lib2to3/refactor.py", line 374, in refactor_string
tree = self.driver.parse_string(data)
File "/anaconda3/envs/deep-grammar/lib/python3.6/lib2to3/pgen2/driver.py", line 107, in parse_string
return self.parse_tokens(tokens, debug)
File "/anaconda3/envs/deep-grammar/lib/python3.6/lib2to3/pgen2/driver.py", line 72, in parse_tokens
if p.addtoken(type, value, (prefix, start)):
File "/anaconda3/envs/deep-grammar/lib/python3.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', (7, 0))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants