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

Unable to import js2py #21

Closed
ghost opened this issue Oct 7, 2015 · 7 comments
Closed

Unable to import js2py #21

ghost opened this issue Oct 7, 2015 · 7 comments

Comments

@ghost
Copy link

ghost commented Oct 7, 2015

After cloning the package and adding its path in sys.path I am not able to import the library.

>>> import Js2Py.js2py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Js2Py/js2py/__init__.py", line 67, in <module>
    from js2py.evaljs import *
ImportError: No module named 'js2py'
>>> sys.path.append('/Users/Js2Py')
>>> import js2py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Js2Py/js2py/__init__.py", line 67, in <module>
    from js2py.evaljs import *
  File "/Users/Js2Py/js2py/evaljs.py", line 56
    exec DEFAULT_HEADER in self._context
                      ^
SyntaxError: Missing parentheses in call to 'exec'
>>> 

operated on python3.4 on Mac

@ghost
Copy link
Author

ghost commented Oct 7, 2015

Got it ! Works for python2.7
Maybe its not python3.x compliant thats why :)

@ghost
Copy link
Author

ghost commented Oct 7, 2015

Oops !! but Still doesn't works

>>> c = js2py.eval_js(d)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/Js2Py/js2py/evaljs.py", line 39, in eval_js
    e = EvalJs()
  File "/Users/js2py/evaljs.py", line 56, in __init__
    exec DEFAULT_HEADER in self._context
  File "<string>", line 1, in <module>
  File "/Users/Js2Py/js2py/pyjs.py", line 3, in <module>
    from constructors.jsdate import Date
  File "/Users/Js2Py/js2py/constructors/jsdate.py", line 2, in <module>
    from time_helpers import *
  File "/Users/Js2Py/js2py/constructors/time_helpers.py", line 4, in <module>
    from tzlocal import get_localzone
ImportError: No module named tzlocal
>>> 

@PiotrDabkowski
Copy link
Owner

You have to install tzlocal. Did you install Js2Py using pip? It should be installed automatically. pip install tzlocal

@PiotrDabkowski
Copy link
Owner

And you are right - python 3 is not supported

@ghost
Copy link
Author

ghost commented Oct 7, 2015

Nopes ! I didn't try with pip
I tried by cloning the repo. Let me try via pip

@liz282907
Copy link

not working ...python 2.7 in mac
image

@PiotrDabkowski
Copy link
Owner

It's not because of the Js2Py. You can clearly see in the error message that the library six fails to install. Try pip install --ignore-installed six and later pip install js2py.

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

No branches or pull requests

2 participants