Skip to content Skip to sidebar Skip to footer

Ioerror In Imported Python Module

I have a module with the following folder structure Module -__init__.py -analyzer.py -lib/ -lib/models -lib/data/ However when used from the parent directory I get an IOError for

Solution 1:

Every Python module must have own __init__.py file:

Module
-__init__.py-analyzer.py-lib/-lib/__init__.py-lib/models/-lib/models/__init__.py-lib/data/-lib/data/__init__.py

The __init__.py files are required to make Python treat the directories as containing packages. In the simplest case, __init__.py can just be an empty file.

See: https://docs.python.org/2/tutorial/modules.html#packages

Post a Comment for "Ioerror In Imported Python Module"