Skip to content

Past.traslate module assumes tmp folder to be present, even on windows platform #295

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

Closed
kapilkd13 opened this issue Aug 6, 2017 · 0 comments · Fixed by #335
Closed

Past.traslate module assumes tmp folder to be present, even on windows platform #295

kapilkd13 opened this issue Aug 6, 2017 · 0 comments · Fixed by #335

Comments

@kapilkd13
Copy link

kapilkd13 commented Aug 6, 2017

I am working on a project that uses past module to run some python 2 code on python3 on Windows OS.
Here is the error:

PS C:\> cwltool
Traceback (most recent call last):
  File "C:\Program Files (x86)\Python\Python3.6\Scripts\cwltool-script.py", line 11, in <module>
    load_entry_point('cwltool==1.0.20170723124118', 'console_scripts', 'cwltool')()
  File "c:\program files (x86)\python\python3.6\lib\site-packages\pkg_resources\__init__.py", line 565, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "c:\program files (x86)\python\python3.6\lib\site-packages\pkg_resources\__init__.py", line 2631, in load_entry_point
    return ep.load()
  File "c:\program files (x86)\python\python3.6\lib\site-packages\pkg_resources\__init__.py", line 2291, in load
    return self.resolve()
  File "c:\program files (x86)\python\python3.6\lib\site-packages\pkg_resources\__init__.py", line 2297, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "c:\program files (x86)\python\python3.6\lib\site-packages\cwltool\main.py", line 22, in <module>
    import schema_salad.validate as validate
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "c:\program files (x86)\python\python3.6\lib\site-packages\past\translation\__init__.py", line 341, in load_module
    mod = imp.load_module(fullname, *self.found)
  File "c:\program files (x86)\python\python3.6\lib\imp.py", line 234, in load_module
    return load_source(name, filename, file)
  File "c:\program files (x86)\python\python3.6\lib\imp.py", line 172, in load_source
    module = _load(spec)
  File "c:\program files (x86)\python\python3.6\lib\site-packages\schema_salad\validate.py", line 3, in <module>
    import avro.schema
  File "<frozen importlib._bootstrap>", line 961, in _find_and_load
  File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 646, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 616, in _load_backward_compatible
  File "c:\program files (x86)\python\python3.6\lib\site-packages\past\translation\__init__.py", line 396, in load_module
    if detect_python2(source, self.pathname):
  File "c:\program files (x86)\python\python3.6\lib\site-packages\past\translation\__init__.py", line 222, in detect_python2
    with open('/tmp/original_code.py', 'w') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/original_code.py'

This problem arises because of the hardcoded tmp folder while writing the to a file in past module see here https://github.com/PythonCharmers/python-future/blob/master/src/past/translation/__init__.py#L221

We should remove this hardcoding and use tmp env variable.

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

Successfully merging a pull request may close this issue.

2 participants