problems with opening files due to file's path
carsten.haese at gmail.com
Wed Jun 11 22:57:32 CEST 2008
> I don't get why yall are being so rude about this.
We're frustrated with your apparent inability to understand anything
> 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.
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:
filename = raw_input("Please enter a filename: ")
Once you get that to work, replace raw_input with a function that gets
the filename from your GUI.
Hope this helps,
More information about the Python-list