I have a file and start it like a command (without full path):
os.system('start rvpush')
or
os.system('start rvpush.exe')
Both start notepad. But if I delete the file it will stop working and generate an error. Everything is logical...
That's a problem. Before I start I need to check if file exists or not. But I don't know where the file is stored.
os.path.exists('rvpush.exe')
return: False... but file exists and started...
I try to get folders from os.environ['PATH']
but the file is not found in these folders...
I'm confused. The file started and worked, but in PATH
environment there is no path to file... How to check a file if you don't know his path?
PS: The task is to check whether the file exists and then run it. I'm not sure that all computers have this file and should be checked before starting. So I'm not sure the file is in the same place, so use just as a command rather than through the full path. In addition to the computer can be windows or linux...
PSS: The disc has many folders, so that the option to just check the whole disk in search of the file is not suitable (it could take a very long time).