Runner Bean Runner Bean - 15 days ago 9
Python Question

Python - import file - SyntaxError: invalid syntax

When I try and import my file into Jupyter using

from fatigue import *


it says

File "myfile.py", line 189
def effectiveness():
^
SyntaxError: invalid syntax


It gives this error in my Atom IDE. Also when I try to run it in Jupyter, I get the same error. It is the only error the IDE is showing for the whole
.py
file.

I am just not sure what to do?

Answer

Looks like you have a error in the effectiveness() function, inside your myfile.py, so when you import this file to your main one, you get that error.

So, first of all, resolve the error back in your myfile.py, then it should work fine! Also, I recommend you to use import fatigue instead of from fatigue import *, it's much better ;)