python -m: Error while finding module specification

Viewed 8519

According to the python doc the -m flag should do the following:

Search sys.path for the named module and execute its contents as the __main__ module.

When I run my script simply with the python command, everything works fine. Since I now want to import something from a higher level, I have to run the script with python -m. However the __name__ == "__main__" statement seems to return False and the following Error is produced:

/home/<name>/anaconda3/bin/python: Error while finding module specification for 'data.generate_dummies.py' (AttributeError: module 'data.generate_dummies' has no attribute '__path__')

I dont't understand what the __path__ attribute has to do with that.

1 Answers
Related