FileExist on DVD-Drive not working?
#1
Sad 
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
Reply
#2
try this :
Quote:import os.path
lyrfile="d:\\subdir\\file.lyr"
if os.path.isfile(lyrfile):
   print "yes"
else:
   print "no"



Reply
#3
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.
Reply
#4
(ruuk @ oct. 12 2005,23:04 Wrote: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.
Reply
#5
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 Smile
Reply

Logout Mark Read Team Forum Stats Members Help
FileExist on DVD-Drive not working?0