Clive fails on being supplied a URL

Bug #242156 reported by gwern
6
Affects Status Importance Assigned to Milestone
clive (Ubuntu)
Invalid
Undecided
Unassigned
Hardy
Invalid
Undecided
Unassigned
m2crypto (Ubuntu)
Fix Released
Undecided
Andrea Gasparini
Hardy
Fix Released
Undecided
Andrea Gasparini

Bug Description

Binary package hint: clive

gwern@craft:11407~>uname -a [12:06PM]
Linux craft 2.6.24-19-generic #1 SMP Wed Jun 18 14:15:37 UTC 2008 x86_64 GNU/Linux
gwern@craft:11402~>lsb_release -rd [12:05PM]
Description: Ubuntu 8.04.1
Release: 8.04
gwern@craft:11403~>apt-cache policy clive [12:05PM]
clive:
  Installed: 0.4.3-1ubuntu1.1
  Candidate: 0.4.3-1ubuntu1.1
  Version table:
 *** 0.4.3-1ubuntu1.1 0
        500 http://archive.ubuntu.com hardy-updates/universe Packages
        100 /var/lib/dpkg/status
     0.4.3-1ubuntu1 0
        500 http://archive.ubuntu.com hardy/universe Packages

gwern@craft:11404~>/usr/bin/clive 'http://www.youtube.com/watch?v=IsptPKzA3zQ' [12:05PM]
clive/0.4.3 (linux2; python/2.5.2; urlgrabber/3.1.0)
[log:on] [play:off] [encode:off] [throttle:off] [exists:skip]
error: Traceback (most recent call last):
  File "/usr/bin/clive", line 83, in <module>
    c.main()
  File "/usr/bin/clive", line 56, in main
    Nomad().run(self.opts, self.args, self._say)
  File "/usr/lib/python2.5/site-packages/clive/nomad.py", line 83, in run
    self._check_raw_urls(raw_urls)
  File "/usr/lib/python2.5/site-packages/clive/nomad.py", line 225, in _check_raw_urls
    self._check_url(url, (index,len(raw_urls)))
  File "/usr/lib/python2.5/site-packages/clive/nomad.py", line 262, in _check_url
    o = g.urlopen(url)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 884, in urlopen
    return self._retry(opts, retryfunc, url)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 845, in _retry
    r = apply(func, (opts,) + args, {})
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 883, in retryfunc
    return URLGrabberFileObject(url, filename=None, opts=opts)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1001, in __init__
    self._do_open()
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1066, in _do_open
    opener = self._get_opener()
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1057, in _get_opener
    self._opener = CachedOpenerDirector(ssl_factory, *handlers)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1312, in CachedOpenerDirector
    opener = ssl_factory.create_opener(*handlers)
  File "/var/lib/python-support/python2.5/urlgrabber/sslfactory.py", line 63, in create_opener
    return m2urllib2.build_opener(self.ssl_context, *handlers)
  File "/var/lib/python-support/python2.5/M2Crypto/m2urllib2.py", line 113, in build_opener
    if inspect.isclass(check):
NameError: global name 'inspect' is not defined
gwern@craft:11405~>/usr/bin/clive 'http://www.youtube.com/' [12:05PM]
clive/0.4.3 (linux2; python/2.5.2; urlgrabber/3.1.0)
[log:on] [play:off] [encode:off] [throttle:off] [exists:skip]
error: Traceback (most recent call last):
  File "/usr/bin/clive", line 83, in <module>
    c.main()
  File "/usr/bin/clive", line 56, in main
    Nomad().run(self.opts, self.args, self._say)
  File "/usr/lib/python2.5/site-packages/clive/nomad.py", line 83, in run
    self._check_raw_urls(raw_urls)
  File "/usr/lib/python2.5/site-packages/clive/nomad.py", line 225, in _check_raw_urls
    self._check_url(url, (index,len(raw_urls)))
  File "/usr/lib/python2.5/site-packages/clive/nomad.py", line 262, in _check_url
    o = g.urlopen(url)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 884, in urlopen
    return self._retry(opts, retryfunc, url)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 845, in _retry
    r = apply(func, (opts,) + args, {})
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 883, in retryfunc
    return URLGrabberFileObject(url, filename=None, opts=opts)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1001, in __init__
    self._do_open()
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1066, in _do_open
    opener = self._get_opener()
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1057, in _get_opener
    self._opener = CachedOpenerDirector(ssl_factory, *handlers)
  File "/var/lib/python-support/python2.5/urlgrabber/grabber.py", line 1312, in CachedOpenerDirector
    opener = ssl_factory.create_opener(*handlers)
  File "/var/lib/python-support/python2.5/urlgrabber/sslfactory.py", line 63, in create_opener
    return m2urllib2.build_opener(self.ssl_context, *handlers)
  File "/var/lib/python-support/python2.5/M2Crypto/m2urllib2.py", line 113, in build_opener
    if inspect.isclass(check):
NameError: global name 'inspect' is not defined
gwern@craft:11406~>clive --help [12:06PM]
Usage: clive [options] URLs

Options:
  --version show program's version number and exit
  -h, --help show this help message and exit
  --check-updates Check for updates
  --configure Configure using a graphical user interface

  Stdout Options:
    -q, --quiet Run quiet
    -e, --emit List found video extraction URLs and exit

  Output Options:
    -o, --overwrite Overwrite already existing output files
    -r, --rename Rename output file to be written if it exists already
    --prefix=PREFIX Write extracted videos to PREFIX
    -O FILE, --output-file=FILE
                        Write videos to FILE
    --output-mask=MASK Set output filename re.sub mask (A-Za-z0-9)
    -M, --disable-mask Disable output mask explicitly
    --output-fmt=FMT Set output filename format (%t.%e)

  Connection Options:
    --proxy=PROXY Set PROXY as HTTP proxy
    --user-agent=AGENT Use AGENT as HTTP user-agent string
    --throttle=LIMIT Set LIMIT as throttle limit for HTTP transfers (KB/s)
    -Z, --disable-gzip Disable gzip HTTP stream compression explicitly
.....

So, clive --help works, and clive plain works (starts some sort of interpreter thingie), but the basic 'clive URL' simply doesn't work. My system is up to date so far as I know.

Revision history for this message
Andrea Gasparini (gaspa) wrote :

Confimed, but it's a bug of m2crypto package, not of clive.

Changed in clive:
status: New → Confirmed
Changed in m2crypto:
assignee: nobody → gaspa
status: New → Confirmed
Andrea Gasparini (gaspa)
Changed in m2crypto:
status: Confirmed → In Progress
Revision history for this message
Andrea Gasparini (gaspa) wrote :

Here's a debdiff that fix the bug on intrepid (and in hardy too)

Changed in clive:
status: Confirmed → Invalid
Revision history for this message
Andrea Gasparini (gaspa) wrote :

Check that the fix is correctly installed:
$ grep inspect /var/lib/python-support/python2.5/M2Crypto/m2urllib2.py
import inspect
            if inspect.isclass(check):
        if inspect.isclass(h):

Using the example of the reporter as Testcase:

$ clive 'http://www.youtube.com/watch?v=IsptPKzA3zQ'
clive/0.4.3 (linux2; python/2.5.2; urlgrabber/3.1.0)
[log:on] [play:off] [encode:off] [throttle:off] [exists:skip]
status: 17KB 100% (1 of 1) [http://www.youtube.com/watch?v=IsptPKzA3zQ...]
status: checking file length... 0.928MB
queue: 1 (total: 0.928MB), failed: 0, skipped: 0.
write: /home/gaspa/Ironballfallsinsand.flv
transfer: 0.928MB / 0.928MB (100%) [00:00:00] 419.05KB/s

Changed in m2crypto:
status: In Progress → Fix Released
Revision history for this message
Andrea Gasparini (gaspa) wrote :

The Impact of that bug involve all people that have installed python-m2crypto and use m2urllib2.py
Direct Reverse Depends are only: python-pyxmpp
but could exists also packages that recommend it, as clive.
(if m2crypto is installed, clive use it by default and for all url, so it won't work anymore)

I don't see any regression possible, as it's only an import of a standard library module.
And it doesn't pollute python namespace, as it's "import inspect", and not "from inspect blabla".

Revision history for this message
gwern (gwern0) wrote :

I can confirm that editing /var/lib/python-support/python2.5/M2Crypto/m2urllib2.py to add the import like the diff suggests seems to fix Clive's downloading - no more error and downloads seem to go fine.

Changed in clive:
status: New → Invalid
Andrea Gasparini (gaspa)
Changed in m2crypto:
assignee: nobody → gaspa
status: New → In Progress
Revision history for this message
Andrea Gasparini (gaspa) wrote :

Debdiff for hardy-proposed:

Changed in m2crypto:
status: In Progress → Confirmed
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

m2crypto (0.18.2-1ubuntu1) intrepid; urgency=low

  * debian/patches/01-inspect_import_missing.patch: inspect import missing
    (LP: #242156)
  * debian/rules,debian/control: added quilt dependency.
  * debian/control: update Maintainer field as per spec.

 -- Andrea Gasparini <email address hidden> Tue, 01 Jul 2008 09:57:26 +0200

Changed in m2crypto:
status: Confirmed → New
Revision history for this message
Luke Yelavich (themuso) wrote :

ACK, however I think the changelog entry needs to explain why the inspect import is needed.

Changed in m2crypto:
status: New → Confirmed
Revision history for this message
Andrea Gasparini (gaspa) wrote :
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

Version 0.18.2-1ubuntu0.1 uploaded to hardy-proposed.

Revision history for this message
Martin Pitt (pitti) wrote :

Accepted into -proposed, please test and give feedback here. Please see https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Thank you in advance!

Changed in m2crypto:
status: Confirmed → Fix Committed
Revision history for this message
Luca Falavigna (dktrkranz) wrote :

No traceback after installing python-m2crypto 0.18.2-1ubuntu0.1 from hardy-proposed.

Revision history for this message
Martin Pitt (pitti) wrote :

Copied to hardy-updates.

Changed in m2crypto:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.