problems with opening files due to file's path

Carsten Haese carsten.haese at gmail.com
Tue Jun 10 15:09:33 EDT 2008


Alexnb wrote:
> No this time it perhaps gave me the worst of all heres what I entered, and
> the output
> 
>>>> startfile(r"%s"%full)    ***full is the path***
> 
> startfile(r"%s"%full)
> 
> WindowsError: [Error 2] The system cannot find the file specified:
> '"C:\\Documents and Settings\\Alex\\My Documents\\My
> Music\\Rhapsody\\Bryanbros\\Jason Mraz\\I\'m Yours (Single)\x01 - I\'m
> Yours.wma"'

Contrary to what other posters have asserted, doing the above can't make 
a difference. Putting 'r' in front of a string literal tells Python not 
to give backslashes in the string literal any special treatment. Since 
there are no backslashes in "%s", the 'r' does nothing.

Therefore, (r"%s"%full) is the same as ("%s"%full), which is the same as 
(full), assuming that `full` is the name of a string.

The real answer lies in fixing the code where you're assigning the 
pathname to 'full', which you haven't posted. Please post the code where 
you're assigning the pathname, or better yet, post the complete code 
you're running.

--
Carsten Haese
http://informixdb.sourceforge.net



More information about the Python-list mailing list