PDA

View Full Version : FileExist on DVD-Drive not working?


Antichrist23
2005-10-11, 10:24
i've rewritten the lyrics-script cause i have neither dsl nor flatrate. the script is looking for a textfile with the same name as the song, but suffix .lyr, read it and show this lyric-text.

works great for now. but only, if the textfile is on the local harddisc. i just tried with several songs and lyrics on a dvd and it seems that i can't get access to the dvd-drive.

i tried fileexist with several combinations of slashes and backslaches like

d:\folder\file.lyr
d:\\folder\file.lyr
iso9660://folder/file.lyr

using the geturl() or getplayingfile()-funktion i can get the full path and filename of the current playing mp3-file.

using this path and file with "fileexist" doesn't work either.

any hints or tips?

thanks in advance.
jens

solexalex
2005-10-11, 21:38
try this :

import os.path
lyrfile="d:\\subdir\\file.lyr"
if os.path.isfile(lyrfile):
* *print "yes"
else:
* *print "no"

ruuk
2005-10-13, 01:04
you need to escape all the \ as in:

'd:\\folder\\file.lyr'

or you can put an r at the beginning of a quoted string (raw)

r'd:\folder\file.lyr'

a url will not work for a path test, and if a function returns a unicode string, that will not work in python on xbmc for many file operations.

Antichrist23
2005-10-14, 09:45
you need to escape all the \ as in:

'd:\\folder\\file.lyr'

or you can put an r at the beginning of a quoted string (raw)

r'd:\folder\file.lyr'

a url will not work for a path test, and if a function returns a unicode string, that will not work in python on xbmc for many file operations.
'd:\\folder\\file.lyr' does not work. file not exist.

same for d:\folder\file.lyr
iso9660://folder//file.lyr
iso9660://folder//file.lyr

as long as the file on harddisc following works perfectly

e:\folder\file.lyr

so it seems it is not a question of backslashes but of accessing the dvd-drive with the built in xbmc-commands.

is this a known bug? i searched in this forum and found out, that two more people already asked a similar question without an answer.

ruuk
2005-10-14, 13:53
we are talking about python code here correct?
because if e:\folder\file.lyr works then i don't see how we are...
if it is, please show a sample of the code (not just the file name but all the code around that)
i haven't had any trouble accessing the dvd drive via python.

please put some code here to give what you are doing some context :)