Am 04.01.2015 um 22:00 schrieb Fernando Morgenstern:
> The issue happened when I was trying to read a file with a relative
> path. I had to use an absolute path to make it work correctly with
> pyinstaller. Here is an example in case anyone have this problem:
>
> if getattr(sys, 'frozen', False):
>     APPLICATION_PATH = os.path.dirname(sys.executable)
> elif __file__:
>     APPLICATION_PATH = os.path.dirname(__file__)
>
> filename = os.path.join(APPLICATION_PATH, 'ui/mainwindow.ui')

So this is (almost) exactly what is written in the manual already, see
<http://pythonhosted.org/PyInstaller/#adapting-to-being-frozen>.

You should use sys._MEIPASS instead of sys.executable, because this is
the documented and supported way of doing it.

-- 
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP
Information Security Management, Security Governance, Secure Software
Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog:
http://www.goebel-consult.de/blog/linux-magazin-empfiehlt-adobe-reader
Kolumne: http://www.cissp-gefluester.de/2010-07-passwoerter-lieben-lernen

Goebel Consult ist Mitglied bei http://www.7-it.de/

-- 
You received this message because you are subscribed to the Google Groups 
"PyInstaller" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to