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
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 set the path to my module one directory below my python 3.7.3 program? deac33 1 75 Jul-30-2019, 04:13 AM
Last Post: Larz60+
  File Path not recognised starzar 3 159 Jul-27-2019, 05:23 AM
Last Post: starzar
  FileNotFoundError...System cannot find the path specified alex9745 28 3,582 Jul-23-2019, 05:14 AM
Last Post: alex9745
  Help | How to make Dynamic Path/Address soothsayerpg 3 187 Jul-14-2019, 03:51 PM
Last Post: DeaD_EyE
  ImportError: cannot import name 'path' user123 2 236 Jul-14-2019, 10:08 AM
Last Post: Larz60+
  Writing the Path to a file properly dcw9996 2 198 Jul-01-2019, 11:26 PM
Last Post: dcw9996
  Help with environment path variables kuharido 0 182 Jun-07-2019, 09:18 PM
Last Post: kuharido
  sys.path miss dist-packages in a virtual env. chomwitt 2 178 May-23-2019, 08:08 PM
Last Post: chomwitt
  Retrieve protocol in lower case Variables 1 188 May-02-2019, 04:46 AM
Last Post: Larz60+
  Linux: Automatically kill process with fixed exe path anddontyoucomebacknomore 4 299 Apr-22-2019, 07:35 AM
Last Post: anddontyoucomebacknomore

Forum Jump:

Users browsing this thread: 2 Guest(s)