Importing modules in python gives syntax error

python

Whenever I try to import modules from python source code files using the python shell(installed in brew folder), I get the following error :

>>> from not import *;
  File "<stdin>", line 1
    from not import *;
           ^
SyntaxError: invalid syntax

Can anyone please help!?

Best Answer

not is a built in boolean operator so you can't use it as the name of a module. If you're trying to load this symbolic negation module: https://www.ics.uci.edu/~eppstein/PADS/Not.py , you need from Not import * (python is case sensitive)

Incidentally, using from x import * is a bad idea in most cases. It breaks static code analysis, it can hide bugs, and you import all kinds of stuff into your namespace. Apart from a few specific use cases, it's probably better to import only what you need or to leave the module its own namespace.