problems with opening files due to file's path

Alexnb alexnbryan at gmail.com
Wed Jun 11 23:01:15 CEST 2008


Well, I don't understand why I don't need to change anything because say I
run that code, which goes straight from the entry box to the startfile()
function. It doesn't work with some of the paths, that is the whole problem.
the problem is when I enter a path with those certain characters next to
each other. Everyone seems like there is some huge thing that I am
missing... and I don't know what it is, because when I run that code, with
that path I was talking about, I get an error, and it shows me that it is
because of the \0. 


Jerry Hill wrote:
> 
> On Wed, Jun 11, 2008 at 4:16 PM, Alexnb <alexnbryan at gmail.com> wrote:
>>
>> I posted the underlying code, but I haven't made the GUI code because if
>> I
>> can't get the underlying code right it doesn't matter, well in my eyes it
>> doesn't but I am probably wrong. But it will look somehting like this:
> 
> What you're missing is that all of the problems you're having with
> escape characters *only apply to string literals inside your python
> source code.*  If you're getting the string from the console, you
> don't need to escape or change anything.  If you're getting the string
> from a Tk text box, you don't need to escape or change anything.  If
> you're getting the string from the filesystem, you don't need to
> escape or change anything.
> 
> The only place you have to be careful is when you type out a literal
> string inside your .py source code.  When you do that, you need to
> properly escape backslashes, either by putting them in raw strings, or
> by doubling up your backslashes.
> 
> If you haven't already, reread the section of the python tutorial
> about string literals: http://docs.python.org/tut/node5.html.
> 
> -- 
> Jerry
> --
> http://mail.python.org/mailman/listinfo/python-list
> 
> 

-- 
View this message in context: http://www.nabble.com/problems-with-opening-files-due-to-file%27s-path-tp17759531p17787168.html
Sent from the Python - python-list mailing list archive at Nabble.com.




More information about the Python-list mailing list