First time here? Check out the FAQ!

Revision history  [back]

why does "import filename" give a SYNTAX error

I have a file A.py in the project directory and another file B.py in the same directory. In B I have the statement "import A" in the first line. I get the following error message:

Syntax Error: invalid syntax:

The same thing happens with : import A.py, import 'A.py', etc. The error is not that the file is missing or that the file has errors, but rather the import statement is syntactically incorrect.

What to do???