-
Notifications
You must be signed in to change notification settings - Fork 256
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
SyntaxError: invalid syntax #571
Comments
It looks like the path PyCharm is using points to an environment that does not have pyjnius installed. Either you didn't install it correctly or there is an issue with PyCharm. Most likely the later. Sometimes IDEs won't automatically find the Python environment you intend and you need to manually point it to the right one. I have this issue from time to time with my IDE. I don't use PyCharm so I can't help you with that part. Good luck. |
I ran the code using the terminal and i got this error: Traceback (most recent call last): the environmental paths are : /home/malkhafa/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin and pyjnius us install at : ./.local/lib/python3.6/site-packages |
this place is not for user support, but for bugs. |
👋 We use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. Please use our support channels to get help with the project. |
I'm trying to test out the sample code provided on Github and I'm getting a syntax error. I have a feeling this might be a pathing issue but pyjnius is in the environment path.
the words jnius and autoclass are underlined in red. When i hover over it, it was " Unresolved reference 'jnius'"
Code:
from time import sleep
from jnius import autoclass
Hardware = autoclass('org.renpy.android.Hardware')
print 'DPI is', Hardware.getDPI()
Hardware.accelerometerEnable(True)
for x in xrange(20):
print Hardware.accelerometerReading()
sleep(.1)
error:
Traceback (most recent call last):
File "/snap/pycharm-community/214/plugins/python-ce/helpers/pydev/pydevd.py", line 39, in
from _pydevd_bundle.pydevd_comm import CMD_SET_BREAK, CMD_SET_NEXT_STATEMENT, CMD_STEP_INTO, CMD_STEP_OVER,
File "/snap/pycharm-community/214/plugins/python-ce/helpers/pydev/_pydevd_bundle/pydevd_comm.py", line 107, in
from _pydev_bundle import _pydev_completer
File "/snap/pycharm-community/214/plugins/python-ce/helpers/pydev/_pydev_bundle/_pydev_completer.py", line 9, in
import java.lang #@UnusedImport
File "/home/malkhafa/PycharmProjects/pythonProject1/java.py", line 5
print 'DPI is', Hardware.getDPI()
^
SyntaxError: invalid syntax
Thanks in advance
The text was updated successfully, but these errors were encountered: