Rose Rose - 1 year ago 225
Linux Question

syntax error near unexpected token while executing a python file

I was trying to execute a python file which not saved in the python directory but in a different one in linux (fedora) terminal. What I tried was:

$ exec(

which resulted an error:

bash: syntax error near unexpected token ''

Could anybody find a solution please...
Thanks in advance

Answer Source

Locate your python's source file

find / -name

and once located run

 python /path_you_found/

if you want your script to be seen from any location for the interpreter you have to add it to PYTHONPATH:


if your script in the same directory you can just run

python ./  
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download