1

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?

3
  • 5
    Chances are it is the line above def effectiveness(): in myfile.py that has the syntax problem. Commented Nov 26, 2016 at 4:38
  • The information you've provided should not give this type of error. We will suggest you to look just before and after this line, see if you implemented the function properly or miss-indented somewhere. Commented Nov 26, 2016 at 4:40
  • 1
    Check if there is any open parenthesis before your method or something wrong before its declaration. Commented Nov 26, 2016 at 4:46

1 Answer 1

1

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 ;)

Sign up to request clarification or add additional context in comments.

5 Comments

why is import fatigue instead of from fatigue import * better?
import fatigue isn't necessarily "much better" than from fatigue import *. It can be argued that it makes your code easier for people to interpret, by explicitly showing what library a function came from, however saying it's "much better" is fairly vague.
@RunnerBean As I said before, fatigue.function() is clearer than function(), however that's the only difference.
Actually, the answers here explain why import * is not the best choice.
@RunnerBean: as Siganl said, there's not a huge difference, but in my case is much better, but just as a personal opinion. If you want to know a bit more, take a look at this link: stackoverflow.com/questions/710551/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.