Re: problems with opening files due to file's path
Alexnb wrote:
We're frustrated with your apparent inability to understand anything
we're saying.
No, no, no, no, NO! That is not your problem! You are drawing unfounded
conclusions from the fact that you had to double up backslashes when the
filename came from a string literal. The situation is entirely different
when the filename comes from user input. No doubling up of backslashes
is necessary when the filename comes from user input. TRUST ME!
For simplicity, start with this code to convince yourself:
import os
filename = raw_input("Plea se enter a filename: ")
os.startfile(fi lename)
Once you get that to work, replace raw_input with a function that gets
the filename from your GUI.
Hope this helps,
--
Carsten Haese
Alexnb wrote:
I don't get why yall are being so rude about this.
we're saying.
My problem is this; the
path, as a variable conflicts with other characters in the path, creating
escape characters I don't want, so I need a way to send the string to the
os.startfile() in raw, or, with all the backslashes doubled.
path, as a variable conflicts with other characters in the path, creating
escape characters I don't want, so I need a way to send the string to the
os.startfile() in raw, or, with all the backslashes doubled.
conclusions from the fact that you had to double up backslashes when the
filename came from a string literal. The situation is entirely different
when the filename comes from user input. No doubling up of backslashes
is necessary when the filename comes from user input. TRUST ME!
For simplicity, start with this code to convince yourself:
import os
filename = raw_input("Plea se enter a filename: ")
os.startfile(fi lename)
Once you get that to work, replace raw_input with a function that gets
the filename from your GUI.
Hope this helps,
--
Carsten Haese
Comment