So my path:
/Users/work/Desktop/My Folder/My File.txt
My Folder and My File have spaces. Of course, in Terminal, when you tab for autocompletion it would do
/Users/work/Desktop/My\ Folder/My\ File.txt.
My problem is when I use that path in python as such:
from subprocess import Popen def print_rc(file): with open(file, 'r') as infile: p = Popen(["lpr -o page-ranges=1-2"], stdin=infile) output = p.communicate()
I get an error that
no such file or directory error. When I do
os.path.exists('/Users/work/Desktop/My Folder/My File.txt'), it turns out as
True. So I think the problem has to do with the spaces.
What would I need to do to make convert the python string into something bash can understand then?