On 2/27/26 3:34 PM, Em wrote: > this_directory = os.path.dirname(__file__) data_path = > os.path.join(this_directory, "_EXCEL-FILE3az.txt") > OutExcelFile = open(data_path,"w") > > I don't understand that line of code....
this_directory contains the path to the directory where the script is being loaded from. os.path.join does what it says. It joins two paths or parts of a path and filename together using the operating-system-native directory delimiter, which is a backslash on windows. So it's joining the path stored in this_directory with the filename "_EXCEL-FILE3az.txt" so that when it's opened, it will be the file that is in the same directory as the script itself. This sidesteps the issue with Windows screwing up the working directory on launch. Hope that helps. Another possibility as I said before is to use the first line above, and then immediately os.chdir(this_directory) which will make all open() calls relative to this_directory. -- https://mail.python.org/mailman3//lists/python-list.python.org
