Giovanni Bajo wrote:
On Wed, 10 Feb 2010 20:00:10 +0100, Marcin Krol <[email protected]> wrote:
Florian Höch wrote:
Hi,
What you really want to do is remove the directory where your
application resides from sys.path, while keeping other entries.
I'm well aware that sys.path should not be empty -- the point is, even
if it's empty the packed binary is still doing those damn imports of
scripts in current directory and I have no idea how to stop that.
So let me get this straight: you need those Python files to stay in the
same directory of the final executable, but you don't want them to be
imported? Is this correct?
Precisely!
Consider such a scenario: an unsuspecting user downloads my binary. He
doesn't even know or care that it has been developed using Python.
However, he happens to have a script called "warnings.py" in a current
directory, as I do, which serves a totally different purpose than
Python's "warnings" module (just like in my case).
And then the user gets an exception in my program. Since he doesn't know
what's going on, he's just going to throw my program away.
Apparently they are imported via a way different than sys.path: it's
probably that importHook function in pyinstaller.
This is because you're rebinding sys.path to a different list.
Now I get it.
PyInstaller
takes a reference to sys.path at startup, so it doesn't see your
modification. I agree this is a bug, and I have just committed a patch to
fix it. Try if it helps.
Thanks a lot, Giovanni!
I take it that I can modify sys.path now and the search path for modules
in a program that is being packed will work as expected?
I'll dl the trunk and give it a try immediately.
Regards,
mk
--
You received this message because you are subscribed to the Google Groups
"PyInstaller" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pyinstaller?hl=en.