Hello everyone…after looking for solutions to my problem I’ve ended up here. nothing found on StackOverflow seemed to work for me.
let me explain my case:
- I’m on WLS running my python app/script…
- I want to run A native windows program that actually works from WLS terminal… this is the working command from WLS shell:
/mnt/c/Program\ Files/ChimeraX/bin/ChimeraX.exe "\\wsl.localhost\Ubuntu-22.04\home\pconesa\software\scipion\data\tests\relion_tutorial\volumes\reference.mrc"
Now this for me had 2 problems.
Problem A: The space at Program Files. No worries I can make a soft link in a path without spaces. Fine.
Second and unsolvable by me: No matter how I compose the path or is I use Shell = True…is that Path doesn’t reach the windows program “untouched”.
Example of my code:
from subprocess import Popen
file = r'\\wsl.localhost\Ubuntu-22.04\home\pconesa\software\scipion\data\tests\relion_tutorial\volumes\reference.mrc'
program = '/home/pconesa/software/ChimeraX/bin/ChimeraX.exe'
Popen([program, file])
On the windows side the program complains about the path:
No such file/path: \\\\wsl.localhost\\Ubuntu-22.04\\home\\pconesa\\software\\scipion\\data\\tests\\relion_tutorial\\volumes\\reference.mrc
Note that backslashes are doubled. I’ve tried many things “Shell=True”, Surrounding the path with double quotes (they end up being doubled as well)…
For me it seems that deep in the Popen… the python string for the file is use as str which actually doubles the backslash.