Export to a file with space in the file path

I would like to save a file using python rs.Command script

rs.Command("-Export {0}.gdf XSymmetry={1} YSymmetry={2} Gravity={3} Enter \
 ".format(mesh_name,sym_X,sym_Y,Gravity))

where my mesh_name = ‘C:\New folder (2)\Sample_TLP_Parameters_Input_1’

Since the mesh name has a space in it, it tends to save to C:\New. Can anyone tell me if there is way to save to the actual mesh_name folder?

1 Like

I think either of these two should work:

mesh_name = '"C:\New folder (2)\Sample_TLP_Parameters_Input_1"' 

(takes advantage of python’s ability to use both double and single quotes)
or

mesh_name = 'chr(34)+C:\New folder (2)\Sample_TLP_Parameters_Input_1+chr(34)' 

(explicitly add double quote with chr(34))

–Mitch

2 Likes

Well that worked! Thank you very much Mitch!