import sys, os
if getattr(sys, 'frozen', False): # path is different
application_path = os.path.dirname(sys.executable) # if its an executable
elif __file__: # or a Python script,
application_path = os.path.dirname(__file__) # this looks for it
with open('test.txt','w') as f:
f.write('test worked')
python utils/makespec.py --onefile txtfomexe.py
python utils/build.py txtfromexe/txtfromexe.spec
with open('test.txt','w') as f:
f.write('test worked')
Goebel Consult, Landshut
http://www.goebel-consult.de
Blog:
http://www.goebel-consult.de/blog/tr-069-auf-fritzbox-ausschalten-und-ergebnis-prufen
Kolumne:
http://www.cissp-gefluester.de/2012-04-compliance-bringt-keine-sicherheit
--
You received this message because you are subscribed to a topic in the Google Groups "PyInstaller" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/pyinstaller/FYR1roP6sb0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to pyinstaller...@googlegroups.com.
To post to this group, send email to pyins...@googlegroups.com.
Visit this group at http://groups.google.com/group/pyinstaller.
For more options, visit https://groups.google.com/d/optout.
But the when running the executable, the file is not created at all.
Goebel Consult, Landshut
http://www.goebel-consult.de
used 'os.path.dirname()' to see if the executable was running from another directory than the one the executable file actually is, and therefore creating the text file there.
Goebel Consult, Landshut
http://www.goebel-consult.de
--