Ram píše v Út 18. 01. 2011 v 19:36 -0800:
> One problem I'm now facing is that in
> many places in the code, we have used resource_filename() -- to get
> the directory in which the file being executed belongs and to generate
> os specific paths. The problem is when everything is clubbed into one
> exe file, it seems that these directory structures break. Is this a
> known problem? Any recommended workarounds?
In general, your app exe file can't access paths this and similar ways:
mypath = os.path.dirname(__file__)
If you want to get folder, where is your created .exe file placed, in
pyinstaller manual it is recommended to use the following:
mypath = os.path.dirname(sys.executable)
So you need in your app to distinguish if you are running the source
code or running the .exe file. This can be done the following way:
if hasattr(sys, 'frozen'):
mypath = os.path.dirname(sys.executable)
else:
mypath = os.path.dirname(__file__)
For details see pyinstaller manual.
--
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.