_LWPCookieJar.py - Saving cookies [windows]
#1
I'm working on a MLB add-on and I'v borrowed some code from mlbviewer that logs in and gets the playback url's. The mlbviewer code uses LWPCookieJar to save cookies, works fine with linux. On windows I get an IOError.
Code:
ERROR: Error Contents: invalid mode: w
ERROR: Traceback (most recent call last):
    File "C:\Users\Christopher\AppData\Roaming\XBMC\addons\plugin.video.mlb.highlights\default.py", line 408, in ?
        setGameURL(url)
    File "C:\Users\Christopher\AppData\Roaming\XBMC\addons\plugin.video.mlb.highlights\default.py", line 109, in setGameURL
         url = getGameURL(url)
    File "C:\Users\Christopher\AppData\Roaming\XBMC\addons\plugin.video.mlb.highlights\default.py", line 182, in getGameURL
        cj.save(COOKIEFILE,ignore_discard=True)
     File "special://xbmc/system/python/Lib\_MozillaCookieJar.py", line 117, in save
        f = open(filename, "w")
IOError: invalid mode: w

As you can see the same error with _MozillaCookieJar.py.

In the past, when I've had this error, adding 'b' to the mode eg.'wb' would work.

Any ideas, workarounds.
Reply
#2
i remember getting a similiar error... which i remember was down to me trying to save in a read-only directory.

you might want to check the file paths.
the error reporting is rubbish for file saving/opening!
Reply
#3
you CANNOT use special:// paths directly in master. you HAVE to push through xbmc.translatePath first. the vfs injection is gone due to using system python. and even in dharma your code will fail due to mixing \ and /.
Reply
#4
Thanks for the reply's. Making a little progress...

What is the proper way to get the userdata dir.? I guess I shouldn't be using -
xbmc.translatePath('special://masterprofile/addon_data')
Reply
#5
addon = xbmcaddon.Addon(myid)
xbmc.translatePath(addon.getAddonInfo('profile'))
Reply
#6
spiff Wrote:addon = xbmcaddon.Addon(myid)
xbmc.translatePath(addon.getAddonInfo('profile'))

Much appreciated.
Reply

Logout Mark Read Team Forum Stats Members Help
_LWPCookieJar.py - Saving cookies [windows]0