I am writing a short code in python to automate a process for co-worker. The program is fairly simple, it finds and extracts a list of names from a text file which has a lot of other junk in it. the list can then be easily compared with other lists or put into an excel file etc.
My thought process is that it would be easiest for them to take the file from the source and paste it into a text file on their desktop that my program will automatically locate, read, and ultimately produce a new clean file from. I've been able to manage all of that on my own with my own computer.
When I want to access the original junk-filled text file on my computer I just write:
f = open("/Users/Jon/Desktop/namelisttext.txt", "r+")
But when I export this program to .exe and send it to a co-worker, this of course won't work because whoever uses it presumably won't have the username "Jon". This seems like it would be a common problem, so I assume there is some easy solution which I haven't been able to find. Is there a way to access the desktop of "current user" or to find a file with a specific name without giving the full path of where it is located?
After some research Environ seems like it might be a good solution, which is designed for PC. The work computers are PC, but I am coding on a Mac, so I'm guessing that means I won't be able to test it on my system.
Any help or alternative ways to circumvent the problem are appreciated!