Hello,
I want to open and setup.exe from python but sometimes it might be with uppercase like Setup.exe. How can I handle it properly?
I have:
myAppLowercase = path\setup.exe
myAppUppercase = path\Setup.exe
what is path/setup.exe?
this code can't possibly work as posted.
please explain in more detail what you are trying to do.
Sorry for missing some important information.
So i want to install an specific app from a python script using this:
os.system('path_to_setup.exe')
This script will be executed on different machines. The app I want to install has multiple versions and for some of them the kit is with uppercase (Setup.exe) and for some of them with lowercase(setup.exe). I have a variable that has the path with lowercase for now:
myInstallPath = path\setup.exe
What I want is to be able to execute, os.system(myInstallPath) no matter if the kit installer is with uppercase or with lowercase.
Thank you
If there are only two possibilities, you can check if the first one exists otherwise use the second path:
my_install_path = 'my_path/setup.exe' if os.path.exists('my_path/setup.exe') else 'my_path/Setup.exe'
the path is not case-sensitive on Windows, so it shouldn't matter
Also should not be using
os.system()
it's deprecated and replaced by the
subprocess module.
As mention bye @
buran so is path/file name not case-sensitive.
import subprocess
subprocess.run(['python', 'version.py'])
So if i have
VeRsiOn.py
as filename it make no difference it run fine.
Thank you for your responses.