KeyboardInterrupt thrown by urlgrab
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
urlgrabber (Fedora) |
Won't Fix
|
Undecided
|
|||
urlgrabber (Ubuntu) |
Won't Fix
|
Undecided
|
Unassigned |
Bug Description
TypeError: start() got an unexpected keyword argument 'size'
Exception in thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/
self.run()
File "/home/
self.
File "/home/
progress_obj = self._progress_obj)
File "/usr/lib/
return default_
File "/usr/lib/
return self._retry(opts, retryfunc, url, filename)
File "/usr/lib/
r = apply(func, (opts,) + args, {})
File "/usr/lib/
fo = PyCurlFileObjec
File "/usr/lib/
self._do_open()
File "/usr/lib/
self._do_grab()
File "/usr/lib/
self.
File "/usr/lib/
raise KeyboardInterrupt
KeyboardInterrupt
This code was working in maverick with python 2.6. It looks like grabber.py is calling the curl_obj with incorrect arguments.
This could be related to bug 776500:
https:/
Before I was using "check_timestamp", now I am trying "simple"
ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: python-urlgrabber 3.9.1-4
ProcVersionSign
Uname: Linux 2.6.38-9-generic x86_64
Architecture: amd64
Date: Tue May 3 10:47:55 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Release amd64 (20110427.1)
PackageArchitec
ProcEnviron:
LANGUAGE=en_US:en
PATH=(custom, user)
LANG=en_US.UTF-8
SHELL=/bin/bash
SourcePackage: urlgrabber
UpgradeStatus: No upgrade log present (probably fresh install)
tags: | added: patch |
Changed in urlgrabber (Ubuntu): | |
status: | New → Triaged |
Changed in urlgrabber (Fedora): | |
importance: | Unknown → Undecided |
status: | Unknown → Won't Fix |
Update:
The problem is that the code is not matching the documentation.
In the python docs for grabber (pydoc urlgrabber. grabber) , the progress_obj is clearly documented as to what arguments are supported:
progress_obj = None
a class instance that supports the following methods:
po.start( filename, url, basename, length, text)
po.update( read) # read == bytes read so far
# length will be None if unknown
po.end()
But, in the actual source shipped with natty, this is the code that calls this method:
def _retrieve(self, buf): progress_ obj:
size = self.size + self._reget_length
self. opts.progress_ obj.start( self._prog_ reportname,
urllib. unquote( self.url) ,
self._prog_ basename,
size=size,
text=self. opts.text)
self. _prog_running = True
self. opts.progress_ obj.update( self._amount_ read)
try:
if not self._prog_running:
if self.opts.
return len(buf)
except KeyboardInterrupt:
return -1
Note how "size" and "text" are passed as named arguments instead of positional arguments?
The correct code should be:
This would correctly match the documentation.
Alternative would be to use length=size and not size=size in the code as the documentation shows the parameter name as "length", not "size".