I have recently begun working on a new computer. All my python files and my data are in the dropbox folder, so having access to the data is not a problem. However, the "user
" name on the file has changed. Thus, none of my os.chdir()
operations work. Obviously, I can modify all of my scripts using a find and replace, but that won't help if I try using my old computer.
Currently, all the directories called look something like this:
"C:\Users\Old_Username\Dropbox\Path
"
and the files I want to access on the new computer look like:
"C:\Users\New_Username\Dropbox\Path
"
Is there some sort of try/except
I can build into my script so it goes through the various path-name options if the first attempt doesn't work?
Thanks!