Four Js Development Tools Forum

Discussions by product => Genero BDL => Topic started by: Dave T. on April 14, 2023, 02:04:24 am



Title: Opening a folder that contains spaces
Post by: Dave T. on April 14, 2023, 02:04:24 am
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


Title: Re: Opening a folder that contains spaces
Post by: william s. on February 23, 2024, 03:20:28 am
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.


Title: Re: Opening a folder that contains spaces
Post by: wilkinson w. on February 23, 2024, 03:35:10 am

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 basketball stars (https://basketballstars-game.com/)

folder_path = 'C:\\Program Files'
os.startfile('"{}"'.format(folder_path))

This will open the folder without any problems due to gaps in the path.
This is an excellent response, and I am quite appreciative of the fact that you choose to provide it.


Title: Re: Opening a folder that contains spaces
Post by: Victor G. on March 14, 2024, 03:31:57 am
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.
phrazle (https://phrazle.co)
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.
I will try, thanks.