Please help with weblogin.py !!
#1
Sad 
IHi all, I must first apologize if the issue is not going on this topic, I'm new and do not understand much. My problem is that e been trying to implement a login system for my addon and throws me the following problem:

00:14:24 T: 4568 ERROR: Thrown EXCEPTION (PythonToCppException): -> Python callback / script returned the following error <-
                                             - NOTE: THIS CAN LEAD TO IGNORING MEMORY LEAKS!
                                            Error Type: <type 'exceptions.IOError'>
                                            Contents Error: (2, 'No such file or directory', u'C: \\ xxxx\\ AppData \\ Roaming user \\ \\ \\ Kodi userdata addon_data \\ \\ \\ plugin.video.david cookiepath \ \ cookies.lwp ')
                                            Traceback (most recent call last):
                                              File "C: \ xxxx\ xxxx\ AppData \ Roaming \ Kodi \ addons \ plugin.video.xxxx\ principal.py", line 30, in <module>
                                                logged_in = weblogin.doLogin ( 'cookiepath', 'username', 'password')
                                              File "C: \ xxxx\ xxxx\ AppData \ Roaming \ Kodi \ addons \ plugin.video.xxxx\ weblogin.py", line 76, in doLogin
                                                cj.save (os.path.join (dataroot, cookiepath))
                                              File "C: \ Program Files (x86) \ Kodi \ system \ python \ Lib \ _LWPCookieJar.py", line 83, in save
                                                f = open (filename, "w")
                                            IOError: (2, 'No such file or directory', u'C: \\ xxxx\\ AppData \\ Roaming user \\ \\ \\ Kodi userdata addon_data \\ \\ \\ cookiepath \\ plugin.video.xxxx cookies.lwp ')
                                            -> End of Python script bug report <-
00:14:24 T: 6940 ERROR: XFILE CDirectory :: :: GetDirectory - Error getting plugin: //plugin.video.xxxx/
00:14:24 T: 6940 ERROR: CGUIMediaWindow :: GetDirectory (plugin: //plugin.video.xxxx/) failed

and tried but can not find the solution, please help me
Reply
#2
See below answer
Reply
#3
Here is my code for globals of default.py

PHP Code:
rootdir xbmcaddon.Addon(id='plugin.video.xxxx').getAddonInfo('path')
mysettings xbmcaddon.Addon(id 'plugin.video.xxxx')
profile mysettings.getAddonInfo('profile')
home mysettings.getAddonInfo('path')
fanart xbmc.translatePath(os.path.join(home'fanart.jpg'))
icon xbmc.translatePath(os.path.join(home'icon.png'))
########################################################################
addon        xbmcaddon.Addon()
addonname    addon.getAddonInfo('id')
addonprofile addon.getAddonInfo('profile').decode('utf-8')
addonversion addon.getAddonInfo('version')
addonpath    addon.getAddonInfo('path').decode('utf-8')
########################################################################
kuser mysettings.getSetting('username')
kpass mysettings.getSetting('password')
########################################################################
addon_handle int(sys.argv[1])

cookiepath xbmc.translatePath(os.path.join(profile'cookies.lwp'))
logged_in weblogin.doLogin('cookiepath','username','password'

I'm using my own login form with php in local mode, and error is always the same

21:41:56 T:7576 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.IOError'>
Error Contents: (2, 'No such file or directory', 'cookiepath\\cookies.lwp')
Traceback (most recent call last):
File "C:\xxxx\xxxx\AppData\Roaming\Kodi\addons\plugin.video.xxxx\principal.py", line 32, in <module>
logged_in = weblogin.doLogin('cookiepath','username','password')
File "C:\xxxx\xxxx\AppData\Roaming\Kodi\addons\plugin.video.xxxx\weblogin.py", line 69, in doLogin
cj.save(cookiepath)
File "C:\Program Files (x86)\Kodi\system\python\Lib\_LWPCookieJar.py", line 83, in save
f = open(filename, "w")
IOError: (2, 'No such file or directory', 'cookiepath\\cookies.lwp')
-->End of Python script error report<--
Reply
#4
you're passing cookiepath as a string instead of a variable?

i guess it needs to be:
PHP Code:
logged_in weblogin.doLogin(cookiepath,'username','password'
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#5
I feel so stupid man Jajajajajaja, thank you !! This is the modification I made to the code to make it work:
PHP Code:
cookiepath xbmc.translatePath(os.path.join(profile))
logged_in weblogin.doLogin(cookiepath,kuser,kpass
Once again, thank you so much !!
Reply

Logout Mark Read Team Forum Stats Members Help
Please help with weblogin.py !!0