Open file in append mode wont work
#1
Hello,
I´m working on my ListenLiveEU addon. Now I have a problem with the append mode.
Everything is ok if I use the write mode, but with append i get this error message:
Quote:Traceback (most recent call last):
File "C:\Users\bootsy\AppData\Roaming\XBMC\addons\plugin.audio.ListenLiveEU\default.py", line 70, in addFav
f.write('name=%s&url=%s%s' % (name, url, '\n'))
IOError: (0, 'Error')

Code:
FILE_FAVS = os.path.join('special://home/userdata/addon_data/plugin.audio.ListenLiveEU', 'favorites.xml')
f = open(xbmc.translatePath(FILE_FAVS),"a")
f.write('name=%s&url=%s%s' % (name, url, '\n'))
f.close()
I also tried 'a+' with the same error.

I´m working with dharma beta1 and Windows 7...

Does anybody have an idea what the problem is?

Greets
Reply
#2
Came across the same issue, so I can confirm it's existence.
Can't however tell you why Sad
Reply
#3
same thing on linux. just open with r+ and scan to the end instead
Reply
#4
our vfs does not support append mode. while it could be "emulated", in the sense that we could move the file pointer to the end of the file, it's better to fail than give the impression that we support it (in particular we cannot "protect" previously written data, i.e., it will behave just as if rw was specified).
Reply
#5
Ok, thanks guys, got it working. Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Open file in append mode wont work0