On 26/02/2026 17:53, Em wrote:
OutExcelFile = open("_EXCEL-FILE3az.txt","w")
The line works in Win 10.
In Win 11, if I press F5 it works but if I double click on the program
filename, it fails immediately.
No error reported.
I believe the problem with the path needing to be different between Win10 and
Win11.
Can you tell me what the path should be if that is the problem?
Python: 3.14.1
"_EXCEL-FILE3az.txt" is a relative path. It looks in the current working directory, wherever
that happens to be. It's better to work with full filepaths. The path of
the script is given by `__file__`, and its directory by
`os.path.dirname(__file__)`, so: this_directory =
os.path.dirname(__file__)
If "_EXCEL-FILE3az.txt" is in the same directory as the script, its full path
will be given by:
data_path =os.path.join(this_directory, "_EXCEL-FILE3az.txt")
You can then write:
OutExcelFile = open(data_path,"w")
--
https://mail.python.org/mailman3//lists/python-list.python.org