Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Case sensitive path

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:


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'
asheru93 likes this post
the path is not case-sensitive on Windows, so it shouldn't matter
asheru93 likes this post
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

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['python', ''])
So if i have as filename it make no difference it run fine.
Thank you for your responses.

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  How do I copy files without case sensitive? mcesmcsc 8 693 Dec-18-2019, 02:19 PM
Last Post: mcesmcsc
  case-sensitive search saisankalpj 1 792 Jul-03-2018, 02:46 PM
Last Post: gruntfutuk
  .pth file does not show up in sys.path when configuring path. arjunsingh2908 2 1,992 Jul-03-2018, 11:16 AM
Last Post: arjunsingh2908

Forum Jump:

Users browsing this thread: 1 Guest(s)