Hi all,

I need to create some text files from an executable file. I am using the 
following code to test it, and while the script creates the text file when 
I call it from the terminal, the executable does not creates the text file. 

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')


I am using 'os.path.dirname()' to get the path of the executable file and 
see if it creates the text file in another directory, but this does not 
seem to be the problem.

In order to create the executable file, I use the following commands:

python utils/makespec.py --onefile txtfomexe.py
> python utils/build.py txtfromexe/txtfromexe.spec 


Should I use any additional option to these commands? What should I do to 
create the file?

I appreciate your help, thank you,
jl 

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

Reply via email to