pyInstaller and multiple directories

1,443 views
Skip to first unread message

adamski

unread,
Sep 25, 2011, 4:18:00 AM9/25/11
to PyInstaller
Hi All;

I'm experimenting with pyInstaller, with a very simply project, but
I'm having problems with importing modules from multiple directories.
Below - I've included a very simple example - I'd really appreciate
any help to get me started. Thanks !

Say I have the following pyInstaller / project structure:

./pyInstaller
./myprogram/myprogram.py
./myprogram/gui/application_frame.py

... where myprogram.py imports the frame script using
"
from gui.application_frame import ApplicationFrame
"

I tried to build my project like this:
cd ./pyinstall
python Configure.py
python Makespec.py ../myprogram/myprogram.py -p ../myprogram/gui
python Build.py ../myprogram/myprogram.py

I get a
"
File "../myprogram/myprogram.py", line 3, in <module>
from gui.application_frame import ApplicationFrame
ImportError: No module named gui.application_frame
"

Thanks !

Hartmut Goebel

unread,
Sep 25, 2011, 5:01:56 AM9/25/11
to pyins...@googlegroups.com
Am 25.09.2011 10:18, schrieb adamski:
I tried to build my project like this:
cd ./pyinstall
python Configure.py
python Makespec.py ../myprogram/myprogram.py -p ../myprogram/gui
python Build.py ../myprogram/myprogram.py

I get a
"
  File "../myprogram/myprogram.py", line 3, in <module>
    from gui.application_frame import ApplicationFrame
ImportError: No module named gui.application_frame
"
Obviously your module/package "gui" is not in the Python search path (PYTHONPATH).

I suggest doing this:
cd ./myprogram
python ../pyinstall/Configure.py
python ../pyinstall/Makespec.py myprogram.py
python ../pyinstall/Build.py myprogram.spec
-- 
Schönen Gruß - Regards
Hartmut Goebel
Dipl.-Informatiker (univ.), CISSP, CSSLP

Goebel Consult 
Spezialist für IT-Sicherheit in komplexen Umgebungen
http://www.goebel-consult.de

Monatliche Kolumne: http://www.cissp-gefluester.de/
Goebel Consult ist Mitglied bei http://www.7-it.de

adamski

unread,
Sep 26, 2011, 3:35:23 AM9/26/11
to PyInstaller
Hi;

Resolved this myself.
python makespec.py ../myprogram/myprogram.py --path=../myprogram/gui

Thanks
Marc



On Sep 25, 10:01 am, Hartmut Goebel <h.goe...@goebel-consult.de>
wrote:
> Am 25.09.2011 10:18, schrieb adamski:> I tried to build my project like this:
> > cd ./pyinstall
> > python Configure.py
> > python Makespec.py ../myprogram/myprogram.py -p ../myprogram/gui
> > python Build.py ../myprogram/myprogram.py
>
> > I get a
> > "
> >   File "../myprogram/myprogram.py", line 3, in <module>
> >     from gui.application_frame import ApplicationFrame
> > ImportError: No module named gui.application_frame
> > "
>
> Obviously your module/package "gui" is not in the Python search path
> (PYTHONPATH).
>
> I suggest doing this:
>
> cd ./myprogram
> python ../pyinstall/Configure.py
> python ../pyinstall/Makespec.py myprogram.py
> python ../pyinstall/Build.py myprogram.*spec*
>
> --
> Schönen Gruß - Regards
> Hartmut Goebel
> Dipl.-Informatiker (univ.), CISSP, CSSLP
>
> Goebel Consult
> Spezialist für IT-Sicherheit in komplexen Umgebungenhttp://www.goebel-consult.de
>
> Monatliche Kolumne:http://www.cissp-gefluester.de/
> Goebel Consult ist Mitglied beihttp://www.7-it.de
>
>  smime.p7s
> 8KViewDownload
Reply all
Reply to author
Forward
0 new messages