problems with opening files due to file's path
alexnbryan at gmail.com
Wed Jun 11 23:04:37 CEST 2008
Haha, okay well sorry that I was being so stupid, but I get it now and I
apoligize for causing you all the frustration. But I did get it to work
Carsten Haese-2 wrote:
> Alexnb wrote:
>> I don't get why yall are being so rude about this.
> We're frustrated with your apparent inability to understand anything
> 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.
> 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("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,
> Carsten Haese
View this message in context: http://www.nabble.com/problems-with-opening-files-due-to-file%27s-path-tp17759531p17787228.html
Sent from the Python - python-list mailing list archive at Nabble.com.
More information about the Python-list