Import2 and folder names with spaces

I’m working on a python script and I am running into trouble with Import2 and windows paths with spaces in them.

The crux is do_command(“Import2: Filename=I:/folder/folder 1/filename.mp3”) fails because Audacity breaks off at the space. I was originally using os.path.join but of course that didn’t work either because of the space. Is it even possible for Import2 to work with the spaces?

Yes, but it must be quoted.
I’ve not tested, but I think all of these should work:

do_command("Import2: Filename='C:/folder/folder 1/filename.mp3'")


do_command("Import2: Filename=\"C:/folder/folder 1/filename.mp3\"")


do_command('Import2: Filename="C:/folder/folder 1/filename.mp3"')

Wow, I managed to somehow miss the straightforward solution in my thrashing around. Now I’m back to theoretically possible at least.