My python script saves a file in parent of file path:
desktop = os.path.dirname(os.path.realpath(__file__))
desktop = os.path.abspath(os.path.join(desktop, os.pardir))
file_path = desktop + "\\" + "text1.txt"
fo = open(file_path, "wb")
fo.write("blabla")
fo.close()
When I turn this python script into exe using py2exe, the path file_path
cannot be found. How to prevent this?
I have found the solution here:
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments