XBMCDOWN plugin program - Urllib issue

Discussion of plugin / script development for XBMC4Xbox
Post Reply
Henning_B
Posts: 19
Joined: Sun Feb 08, 2015 7:45 pm
Has thanked: 1 time
Been thanked: 1 time

XBMCDOWN plugin program - Urllib issue

Post by Henning_B » Wed Feb 10, 2016 9:24 am

Code: Select all

11:56:57 M: 28323840  NOTICE: -->Python Initialized<--
11:57:00 M: 24776704  NOTICE: Installing Url :
11:57:03 M: 24543232   ERROR: Error Type: <type 'exceptions.IOError'>
11:57:03 M: 24543232   ERROR: Error Contents: [Errno 22] Windows Error 0x57: ''
11:57:03 M: 24530944   ERROR: Traceback (most recent call last):
                                              File "Q:\plugins\programs\XBMCDOWN\default.py", line 448, in <module>
                                                elif mode == 'installapp'  : INSTALLAPP(name, url, type, repo)
                                              File "Q:\plugins\programs\XBMCDOWN\default.py", line 256, in INSTALLAPP
                                                downloader.download(url, lib, dp)
                                              File "Q:\plugins\programs\XBMCDOWN\downloader.py", line 9, in download
                                                urllib.urlretrieve(url,dest,lambda nb, bs, fs, url=url: _pbhook(nb,bs,fs,url,dp))
                                              File "Q:\system\python\python27.zlib\urllib.py", line 94, in urlretrieve
                                                return _urlopener.retrieve(url, filename, reporthook, data)
                                              File "Q:\system\python\python27.zlib\urllib.py", line 240, in retrieve
                                                fp = self.open(url, data)
                                              File "Q:\system\python\python27.zlib\urllib.py", line 208, in open
                                                return getattr(self, name)(url)
                                              File "Q:\system\python\python27.zlib\urllib.py", line 463, in open_file
                                                return self.open_local_file(url)
                                              File "Q:\system\python\python27.zlib\urllib.py", line 477, in open_local_file
                                                raise IOError(e.errno, e.strerror, e.filename)
                                            IOError: [Errno 22] Windows Error 0x57: ''
11:57:06 M: 33333248   ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
11:57:06 M: 33333248  NOTICE: CCurlFile::FillBuffer - Reconnect, (re)try 1
11:57:06 M: 33333248   ERROR: CCurlFile::FillBuffer - Failed: HTTP response code said error(22)
11:57:06 M: 33333248   ERROR: CCurlFile::CReadState::Connect, didn't get any data from stream.
anyone seen anything like this beforE?

User avatar
Dan Dar3
Posts: 1147
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 246 times
Been thanked: 243 times
Contact:

Re: Urllib issue

Post by Dan Dar3 » Wed Feb 10, 2016 4:49 pm

What is XBMCDOWN and where did you get it from? seeing the sources might help to understand the stack trace.

It is trying to download something from somewhere.

Code: Select all

11:57:03 M: 24530944   ERROR: Traceback (most recent call last):
                                              File "Q:\plugins\programs\XBMCDOWN\default.py", line 448, in <module>
                                                elif mode == 'installapp'  : INSTALLAPP(name, url, type, repo)
                                              File "Q:\plugins\programs\XBMCDOWN\default.py", line 256, in INSTALLAPP
                                                downloader.download(url, lib, dp)
If you edit Q:\plugins\programs\XBMCDOWN\default.py to add a print statement at line 256 at least for the URL, then you can see in Q:\xbmc.log the value on next run. Note Python is sensitive to indentation, when editing indend as much and with the same characters as the line you add before, below it's just an example to give you an idea of what you need to add.

Code: Select all

print "URL = " + url
downloader.download(url, lib, dp)
Without seeing the rest of the actual code it is possible lib is a local file that its trying to download into, that might actually be the cause of the problem, you might want to add a print statement for that as well. If the path is incorect / does not exist it might throw that error 22. By name I would say dp is a DialogProgress to show download progress, so no need to print that.

User avatar
byron
Posts: 575
Joined: Wed Jul 04, 2012 9:26 pm
Location: Illinois
Has thanked: 26 times
Been thanked: 92 times

Re: XBMCDOWN plugin program - Urllib issue

Post by byron » Sat Feb 20, 2016 4:01 pm

@Dan Dar3...possibly unrelated to this addon but pertaining to script.module.urlresolver (which may or may not be an issue in this example), we are grabbing the latest version 2.10.0 from the Gotham repo I believe. It doesn't work, and I've tried fixing it but with no luck. This was the initial first error I got before I started messing with it:

Code: Select all

06:59:19 M: 25214976  NOTICE: URLResolver: Initializing URLResolver version: 2.10.0
06:59:19 M: 25530368   ERROR: Error Type: <type 'exceptions.TypeError'>
06:59:19 M: 25530368   ERROR: Error Contents: int() argument must be a string or a number, not 'NoneType'
06:59:19 M: 25526272   ERROR: Traceback (most recent call last):
                                              File "Q:\plugins\video\[removed]\default.py", line 1296, in <module>
                                                import urlresolver
                                              File "Q:\scripts\.modules\script.module.urlresolver\lib\urlresolver\__init__.py", line 233, in <module>
                                                _update_settings_xml()
                                              File "Q:\scripts\.modules\script.module.urlresolver\lib\urlresolver\__init__.py", line 181, in _update_settings_xml
                                                lazy_plugin_scan()
                                              File "Q:\scripts\.modules\script.module.urlresolver\lib\urlresolver\__init__.py", line 48, in lazy_plugin_scan
                                                plugnplay.scan_plugins(UrlWrapper)
                                              File "Q:\scripts\.modules\script.module.urlresolver\lib\urlresolver\plugnplay\__init__.py", line 210, in scan_plugins
                                                found_plugin.priority = int(_priority)
                                            TypeError: int() argument must be a string or a number, not 'NoneType'
could never get it going so I just kept using 2.5.0 which was in the frodo repo but is no more:

http://forum.kodi.tv/showthread.php?tid=218232

So unless I'm the only one getting the above error that means that none of the addons that require it are working either, and apologies if this doesn't pertain to this topic exactly but I thought maybe this could be useful.

Henning_B
Posts: 19
Joined: Sun Feb 08, 2015 7:45 pm
Has thanked: 1 time
Been thanked: 1 time

Re: XBMCDOWN plugin program - Urllib issue

Post by Henning_B » Sat Feb 20, 2016 6:55 pm

I solved this issue, thread should be removed.

User avatar
Dan Dar3
Posts: 1147
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 246 times
Been thanked: 243 times
Contact:

Re: XBMCDOWN plugin program - Urllib issue

Post by Dan Dar3 » Sat Feb 20, 2016 6:57 pm

Byron, I don't think it's the same problem, it has a different stack trace.

I only had a quick glance at the code, I couldn't find the exact 2.10 version in the releases section so I could only have a look at the latest sources. Not sure what exactly it does with that get_setting() call [gets some value from the get_setting_xml() from each plugin?] You could try adding some print statement in the for loop to see if it crashes with the first plugin or some specific plugin, or simply add TypeError exception to the catch and pass the suggestion back to the author through a GitHub issue to do the same (it kinda makes sense, since it fails, assume 100 - now why it fails for you and it doesn't for them, that still needs some more investigation that's why I sugested adding some print statement to see with which plugin it fails and why).

line 210 in https://github.com/Eldorados/script.mod ... _init__.py

Code: Select all

                        _priority = common.addon.get_setting('%s_priority' % found_plugin.class_name)
                        try:
                            found_plugin.priority = int(_priority)
                        except ValueError, TypeError:
                            found_plugin.priority = 100

User avatar
Dan Dar3
Posts: 1147
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 246 times
Been thanked: 243 times
Contact:

Re: XBMCDOWN plugin program - Urllib issue

Post by Dan Dar3 » Sat Feb 20, 2016 7:04 pm

Thanks Henning_B. I know you mentioned you are working on your private code and you're not sure whether the plugin would respect the forum rules, but if you feel you can share the solution without revealing too much of it, it might help some other fellow finding this thread later.

Henning_B
Posts: 19
Joined: Sun Feb 08, 2015 7:45 pm
Has thanked: 1 time
Been thanked: 1 time

Re: XBMCDOWN plugin program - Urllib issue

Post by Henning_B » Sat Feb 20, 2016 9:32 pm

issues were special chars in link :P

User avatar
Dan Dar3
Posts: 1147
Joined: Sun Jul 08, 2012 4:09 pm
Has thanked: 246 times
Been thanked: 243 times
Contact:

Re: XBMCDOWN plugin program - Urllib issue

Post by Dan Dar3 » Sat Feb 20, 2016 10:33 pm

Great, thanks, that would make some sense then.

Code: Select all

File "Q:\system\python\python27.zlib\urllib.py", line 477, in open_local_file
                                                raise IOError(e.errno, e.strerror, e.filename)
                                            IOError: [Errno 22] Windows Error 0x57: ''
https://msdn.microsoft.com/en-us/librar ... 2147217396

RichardDol
Posts: 4
Joined: Fri Dec 14, 2018 3:02 pm
Been thanked: 1 time

Re: XBMCDOWN plugin program - Urllib issue

Post by RichardDol » Fri Dec 14, 2018 3:07 pm

I had the same problem. Thank you very much

BarryZon
Posts: 10
Joined: Wed Jun 26, 2019 9:49 pm
Location: United Kingdom
Been thanked: 2 times
Contact:

XBMCDOWN plugin program Urllib issue

Post by BarryZon » Fri Jul 05, 2019 12:00 am

Need something better to get values. It would be great to have mysql_get_field or c_strtok like in RAZADreNaLiNe-DJ plugin are.

Post Reply