Path question

Scott David Daniels Scott.Daniels at Acm.Org
Tue Feb 3 18:42:21 EST 2009


Geert Vancompernolle wrote:
> I have the following path construction: ...
> ./src/__init__.py
>     /main.py
>     /modules/__init__.py
>             /application.py
>     /ui/__init__.py
>        /mainwindow/__init__.py
>                   /mainwindow.py
> I want to call ... 'MainWindow' in module 'mainwindow', from 'application'.

> I'm having the following import statement in 'applications.py':
> from .. ui.mainwindow.mainwindow import MainWindow


If you run the application with the command:
     python -m src.modules.application ...
rather than
     python src/modules/application.py ...
your import should work.
You need to make the package layering to application explicit.
Similarly, you can start Idle with:
     python -m idlelib.idle ...

--Scott David Daniels
Scott.Daniels at Acm.Org



More information about the Python-list mailing list