Add additional import path

28 views
Skip to first unread message

antony

unread,
Sep 11, 2012, 10:08:54 AM9/11/12
to pyins...@googlegroups.com
Hello,

My bootstrap.py script,
import sys
latest_version = "v1.0"
sys.path.append("/home/myapp)
import app

I am getting import error - module app  not found

I would like to add another directory on the file system to the current sys.path

from there I want to able to import my other python modules

Any help,

thanks,
Antony






Martin Zibricky

unread,
Sep 11, 2012, 10:34:01 AM9/11/12
to pyins...@googlegroups.com
Hi antony,

please provide more details and context of your goal.

antony píše v Út 11. 09. 2012 v 07:08 -0700:

antony

unread,
Sep 12, 2012, 8:31:48 AM9/12/12
to pyins...@googlegroups.com
Hi Martin,

Here is what I want to do:

Let the .exe created by pyinstaller contain python and the standard libraries.
At run time, I want on the same level as the exe a lib directory and a myapp directory
The lib directory contains the third party modules which will be used.
The myapp directory contains my code.

Now, when myapp.exe is run, I should be able to import modules from myapp and lib directories.

I have already managed to import and run stuff from myapp directory (by appending to sys.path in myapp.exe); imports from lib seem to work at the top level, but fail when there are sub-packages involved.

Error:
File "home\myapp\PyInstaller\loader\iu.py", line 409, in import Hook
ImportError: No module named http

Any suggestions?
Reply all
Reply to author
Forward
0 new messages