Hi Hartmut,
Thank you for your answer.
I understand that the file is to be created in the current directory with
this code, When running the script, the text file is created successfully
in the working directory. But the when running the executable, the file is
not created at all.
On 23 February
Am 23.02.2015 um 11:52 schrieb Jose Luis Da:
with open('test.txt','w') as f:
f.write('test worked')
Obviously this file is to be created in the current working directory,
because you are not adding any path to it. Try using an absolut path
like /tmp/text.txt or C:\text.txt
--
Am 23.02.2015 um 12:07 schrieb Da, Jose Luis:
But the when running the executable, the file is not created at all.
I doubt this. Have you tried using an absolute path? What error messages
do you get?
--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP
Information Security
Am 23.02.2015 um 12:09 schrieb Da, Jose Luis:
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.
os.path.dirname does *not* give you the current working directory.
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):
I 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.
On 23 February 2015 at 12:07, Da, Jose Luis joseluis.d...@upf.edu wrote:
Hi Hartmut,
Thank you for your answer.
I
What do you mean using an absolute path? Instead of saving the file as
'test.txt', puting something like 'C:\user\desktop\text.txt',? I have not
tried that, I will do it now.
I do not get any error messages, the executable runs fine.
On 23 February 2015 at 12:11, Hartmut Goebel
In the files hook-PyQt4.Qt.py and the very similar hook-PyQt5.Qt.py, there
is a complete list of all PyQt modules as hiddenimports:
hiddenimports = ['sip',
'PyQt4.QtAssistant',
'PyQt4.QtCore',
'PyQt4.QtGui',
'PyQt4.QtNetwork',