0

For example:

  1. Get the file path.

    ATPPath = self.fl_ctrl.GetPath()
    
  2. Add the file path in command

    Command=  some commands in double quotes + ATPPath
    
  3. Pass the command to run on CMD prompt

    os.system(Command)
    

While running the above command it is breaking at spaces present in the folder name in the path.

Input path =>

D:\R-TOOL_SVN\input files\4.1.5-TRANSITION_ALTITUDES-Transition_Altitudes-Half_Bank-ATP.yml

Expected output path =>

D:\R-TOOL_SVN\"input files"\4.1.5-TRANSITION_ALTITUDES-Transition_Altitudes-Half_Bank-ATP.yml
John Kugelman
  • 349,597
  • 67
  • 533
  • 578
  • Does this answer your question? [os.system to invoke an exe which lies in a dir whose name contains whitespace](https://stackoverflow.com/questions/6977215/os-system-to-invoke-an-exe-which-lies-in-a-dir-whose-name-contains-whitespace) – mkrieger1 Dec 30 '21 at 14:36

1 Answers1

0

What you probably want, if I understand correctly, is a way to pass a file path as an argument to a function. In order to do this, you need to escape the spaces. Try something like this:

filepath.replace(" ", "\ ")
benjixinator
  • 129
  • 1
  • 12