Giovanni Bajo wrote:
I understand your concerns. There are two different issues there:

1) The fact that PyInstaller *ever* looks outside of the bundled
executable is surely worth an option.

Oh absolutely!

This just needs to be controlled: depending on context and intent of packaged program author, sometimes it's invaluable, sometimes it's a problem.


It is debatable which is the
correct default,

I don't think there is correct default: suppose someone makes plugins or other scripts importable in their program (in fact I'm planning to write precisely such a program that would be packed by pyinstaller, an extendable agent running as native binary to get rid of risky dependencies on local python and extensions). In that case importing from some/current directory is a must. In other cases, like mine with cssh, it's undesireable.

I really don't want to sound like pain in the ass with this. It's just doing things like pyinstaller does is fragile and even such a small thing can be a showstopper preventing people like me from using pyinstaller, esp. I think on Windows.

and I suspect that most people would expect the default
to be "never import a python file from the file system". This option is
on the todo list.

Great!


2) In case that we want to allow importing files from the filesystem,
there are two possibilities: either we look on the filesystem BEFORE
looking within the bundled executable, or AFTER. You know understand
that this is a matter of how the sys.path is assembled at startup. I
believe there are good arguments for both cases (eg: looking on the
filesystem BEFORE is a good way to distribute small and fast patches to
the program), so this should also be an option.

Well. If you want to do work to actually implement such behavior, I would certainly welcome it!

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?


It should, but I await your tests :)

Testing it now.

--
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.

Reply via email to