Hi all,
Does anyone have any tricks to allow a folder to be opened (that contains spaces) with the os.Path.dirOpen method on a Windows client ?
Cheers
Dave
To open a folder with spaces using the os.Path.dirOpen function on a Windows client, wrap the folder path in double quotes. This ensures that the entire path is handled as a single item, with the spaces not construed as separators.
For instance, if the folder location is "C:\Program Files", you can open it with the following code:
import os
folder_path = 'C:\\Program Files'
os.startfile('"{}"'.format(folder_path))
This will open the folder without any problems due to gaps in the path.