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

SyntaxError: invalid syntax (Line 82) #111

Open
Nornode opened this issue Jul 16, 2021 · 4 comments
Open

SyntaxError: invalid syntax (Line 82) #111

Nornode opened this issue Jul 16, 2021 · 4 comments
Labels

Comments

@Nornode
Copy link

Nornode commented Jul 16, 2021

Trying:
sudo python ./cc2538-bsl.py -p "/dev/ttyUSB1" -ewv "CC2652RB_coordinator_20210120.hex"
results in:

File "./cc2538-bsl.py", line 82
    print(message, end=attr, file=sys.stderr)
                      ^
SyntaxError: invalid syntax
python --version
Python 3.9.6

And Python 3.7.7

@JelmerT JelmerT added the bug label Aug 27, 2021
@jayrobwilliams
Copy link

I had this same error with Python 3.5, 3.7, and 3.9 when using a conda environment. When I used pip3 to install the dependencies and used my system python to run the script, everything worked fine. Maybe there is a difference in one of the dependencies between pip and conda.

@JelmerT
Copy link
Owner

JelmerT commented Mar 10, 2022

This looks like an odd error, the error looks like you're running python 2, but when you do --version it is python 3.

Is there a reason why you're using sudo? and might that influence the python version that's being used? Could you try sudo python --version?

Is @jayrobwilliams his suggestion relevant to you?

@jayrobwilliams
Copy link

I had to use sudo because I got a permissions error when I didn't. You're right that sudo python is invoking the system python instead of the conda one:

$ which python
/home/rob/miniconda3/envs/zigbee/bin/python
sudo which python
/usr/bin/python

Turns out this is due to sudo having a different PATH than a standard shell, and can be fixed by running sudo conda activate <environment> instead of simply conda activate <environment> https://stackoverflow.com/a/36659493.

@JelmerT
Copy link
Owner

JelmerT commented Mar 22, 2022

@Nornode did you see the same issue as @jayrobwilliams , did this fix your problem?

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

No branches or pull requests

3 participants