PythonCharmers/python-future

ParseError when trying to translate a module

Open

#353 ouverte le 13 août 2018

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)Python (327 forks)batch import
0.22bughelp wanted

Métriques du dépôt

Stars
 (1 172 stars)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

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))

Guide contributeur