Using python with windows I’m trying to get my program to see if Dropbox.exe exists if it doesn’t nothing will happen if it does then the program will run. I used the print appdata as a debugging feature and this is what it prints: C:\Users\Me\AppData\Roaming
and I think the problem is that it needs to print C:\\Users\\me\\AppData\\Roaming\\ so then I can add the last part as \\Dropbox\\bin\\Dropbox.exe
import winpaths
appdata = winpaths.get_appdata()
print appdata
try:
with open('appdata\Dropbox\bin\Dropbox.exe') as f: pass
except IOError as e:
print 'dropbox cant be found'
You don’t seem to be using the appdata variable in your open: