You are not logged in.

#1 2013-07-11 21:31:47

amatriain
Member
Registered: 2011-06-02
Posts: 51

After python2-cherrypy update, Calibre web server stops working

After the recent python2-cherrypy update (3.2.2-2 => 3.2.3-1), the Calibre web server stopped working. Trying to load the page returns an HTTP 500 error page generated by cherrypy.

Downgrading python2-cherrypy to 3.2.2-2 the server works again.

The folowing appears in Calibre error log:

(11/Jul/2013:23:13:36) HTTP Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
    ans = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
    self.secret)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 342, in digest_auth
    ha1 = get_ha1(realm, auth.username)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 55, in get_ha1
    return md5_hex('%s:%s:%s' % (username, realm, password))
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
    md5_hex = lambda s: md5(ntob(s)).hexdigest()
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 58, in ntob
    assert_native(n)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 96, in assert_native
    raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)

(11/Jul/2013:23:13:37) HTTP Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
    ans = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
    self.secret)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 342, in digest_auth
    ha1 = get_ha1(realm, auth.username)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 55, in get_ha1
    return md5_hex('%s:%s:%s' % (username, realm, password))
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
    md5_hex = lambda s: md5(ntob(s)).hexdigest()
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 58, in ntob
    assert_native(n)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 96, in assert_native
    raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)

(11/Jul/2013:23:13:38) HTTP Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
    ans = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
    self.secret)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 342, in digest_auth
    ha1 = get_ha1(realm, auth.username)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 55, in get_ha1
    return md5_hex('%s:%s:%s' % (username, realm, password))
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
    md5_hex = lambda s: md5(ntob(s)).hexdigest()
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 58, in ntob
    assert_native(n)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 96, in assert_native
    raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)

(11/Jul/2013:23:13:38) HTTP Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpdispatch.py", line 34, in __call__
    return self.callable(*self.args, **self.kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 54, in do
    ans = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/library/server/utils.py", line 108, in authenticate
    self.secret)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 342, in digest_auth
    ha1 = get_ha1(realm, auth.username)
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 55, in get_ha1
    return md5_hex('%s:%s:%s' % (username, realm, password))
  File "/usr/lib/python2.7/site-packages/cherrypy/lib/auth_digest.py", line 30, in <lambda>
    md5_hex = lambda s: md5(ntob(s)).hexdigest()
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 58, in ntob
    assert_native(n)
  File "/usr/lib/python2.7/site-packages/cherrypy/_cpcompat.py", line 96, in assert_native
    raise TypeError("n must be a native str (got %s)" % type(n).__name__)
TypeError: n must be a native str (got unicode)

Edit: added code tags.

Last edited by amatriain (2013-07-11 21:42:06)

Offline

#2 2013-07-11 21:34:15

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: After python2-cherrypy update, Calibre web server stops working

amatriain, please edit your post.
When pasting code or command output, please use [ code ] tags https://bbs.archlinux.org/help.php#bbcode

like this

It makes the code more readable and - in case of longer listings - more convenient to scroll through.

Offline

#3 2013-07-15 12:00:37

amatriain
Member
Registered: 2011-06-02
Posts: 51

Re: After python2-cherrypy update, Calibre web server stops working

Added a bug report:

https://bugs.archlinux.org/task/36159

Nobody else is experiencing this?

Offline

#4 2013-07-15 16:43:29

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: After python2-cherrypy update, Calibre web server stops working

Name           : calibre
Version        : 0.9.39-1
Name           : python2-cherrypy
Version        : 3.2.3-1

Working fine here. You don't have any old python libraries hanging around that were manually installed, do you?

Scott

Offline

#5 2013-07-15 17:18:10

amatriain
Member
Registered: 2011-06-02
Posts: 51

Re: After python2-cherrypy update, Calibre web server stops working

The only python package I have installed from AUR is python3-threaded_servers (needed for pacserve). Or at least it's the only python package that appears when I run "pacman -Qm". I've tried uninstalling it and restarting calibre, and the error persists.

These are the python-related packages I currently have installed, all from official repos:

$ pacman -Qs python
local/libreoffice-common 4.0.4-1 (libreoffice)
    common files for LibreOffice - a productivity suite that is compatible with
    other major office suites
local/mysql-python 1.2.4-2
    MySQL support for Python
local/pyalpm 0.6.1-1
    Libalpm bindings for Python 3
local/pycups 1.9.62-1
    Python CUPS Bindings
local/pygtk 2.24.0-3
    Python bindings for the GTK widget set
local/pyqt4-common 4.10.2-2
    Common PyQt files shared between python-pyqt4 and python2-pyqt4
local/pysmbc 1.0.13-1
    Python bindings for libsmbclient
local/python 3.3.2-1
    Next generation of the python high-level scripting language
local/python-beaker 1.6.4-1
    Caching and sessions WSGI middleware for use with web applications and
    stand-alone Python scripts and applications
local/python-cairo 1.10.0-2
    Python bindings for the cairo graphics library
local/python-dbus-common 1.2.0-1
    Common dbus-python files shared between python-dbus and python2-dbus
local/python-mako 0.8.1-1
    Hyperfast and lightweight templating for the Python2 platform
local/python-markupsafe 0.18-1
    Implements a XML/HTML/XHTML Markup safe string for Python
local/python-xdg 0.25-1
    Python library to access freedesktop.org standards
local/python2 2.7.5-1
    A high-level scripting language
local/python2-beaker 1.6.4-1
    Caching and sessions WSGI middleware for use with web applications and
    stand-alone Python scripts and applications
local/python2-beautifulsoup3 3.2.1-2
    A Python HTML/XML parser designed for quick turnaround projects like
    screen-scraping
local/python2-cairo 1.10.0-1
    Python2 bindings for the cairo graphics library
local/python2-chardet 2.0.1-6
    Python2 module for character encoding auto-detection
local/python2-cherrypy 3.2.3-1
    A pythonic, object-oriented web development framework
local/python2-crypto 2.6-3
    Collection of cryptographic algorithms and protocols, implemented for use
    from Python 2.
local/python2-cssselect 0.8-1
    A Python2 library that parses CSS3 Selectors and translates them to XPath
    1.0
local/python2-cssutils 0.9.10-1
    A CSS Cascading Style Sheets library for Python
local/python2-dateutil 2.1-6
    Provides powerful extensions to the standard datetime module
local/python2-dbus 1.2.0-1
    Python 2.7 bindings for DBUS
local/python2-distribute 0.6.45-1
    Easily build and distribute Python packages
local/python2-dnspython 1.10.0-1
    A DNS toolkit for Python
local/python2-gobject 3.8.3-1
    Python 2 bindings for GObject
local/python2-gobject2 2.28.6-9
    Python 2 bindings for GObject2
local/python2-imaging 1.1.7-8
    PIL. Provides image processing capabilities for python
local/python2-lxml 3.2.1-1
    Python2 binding for the libxml2 and libxslt libraries
local/python2-mako 0.8.1-1
    Hyperfast and lightweight templating for the Python2 platform
local/python2-markupsafe 0.18-1
    Implements a XML/HTML/XHTML Markup safe string for Python
local/python2-mechanize 0.2.5-3
    Stateful programmatic web browsing in Python
local/python2-netifaces 0.8-2
    Portable module to access network interface information in Python
local/python2-notify 0.1.1-12
    Python bindings for libnotify
local/python2-paramiko 1.10.1-1
    Python module that implements the SSH2 protocol
local/python2-pexpect 2.4-2
    Make Python a better tool for controlling and automating other programs
local/python2-psutil 1.0.1-1
    A cross-platform process and system utilities module for Python2
local/python2-pycurl 7.19.0-2
    A Python 2.x interface to libcurl
local/python2-pyopenssl 0.13-2
    Python2 wrapper module around the OpenSSL library
local/python2-pyqt4 4.10.2-2
    A set of Python 2.x bindings for the Qt toolkit
local/python2-pysqlite 2.6.3-3
    A Python DB-API 2.0 interface for the SQLite embedded relational database
    engine
local/python2-sip 4.14.7-1
    Python 2.x SIP bindings for C and C++ libraries
local/python2-six 1.3.0-1
    Python 2 and 3 compatibility utilities
local/python2-xdg 0.25-1
    Python library to access freedesktop.org standards
local/python2-zope-interface 4.0.5-1
    Zope Interfaces for Python2
local/sip 4.14.7-1
    A tool that makes it easy to create Python bindings for C and C++ libraries
local/twisted 13.0.0-1
    Asynchronous networking framework written in Python

As far as I remember I've never installed any python libraries without pacman. Just to be on the safe side, is there any way to list installed python libraries to compare them against that list?

Offline

#6 2013-07-15 17:41:01

jrussell
Member
From: Cape Town, South Africa
Registered: 2012-08-16
Posts: 510

Re: After python2-cherrypy update, Calibre web server stops working

nothing from pip?


bitcoin: 1G62YGRFkMDwhGr5T5YGovfsxLx44eZo7U

Offline

#7 2013-07-15 17:56:14

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: After python2-cherrypy update, Calibre web server stops working

I'd uninstall calibre, python2-cherrypy and any other calibre dependencies and then go into the site packages directory and make sure they  are completely gone. I really can't think of anything else that might cause an error like that...

Scott

Offline

#8 2013-07-17 18:24:05

amatriain
Member
Registered: 2011-06-02
Posts: 51

Re: After python2-cherrypy update, Calibre web server stops working

@jrussell: I don't have pip installed.

Offline

#9 2013-07-21 15:56:34

amatriain
Member
Registered: 2011-06-02
Posts: 51

Re: After python2-cherrypy update, Calibre web server stops working

@firecat53 : do you have a user/password set in the calibre web server config? If not, could you please try setting non-blank user and password, restarting the server and try to access the calibre web interface again?

I've found that in my setup setting any non-blank password causes the server to fail. The workaround I'm using is to leave the calibre server unprotected (blank password) but run it behind an Apache reverse proxy with digest authentication to restrict access. It would be interesting to compare with your setup.

Offline

#10 2013-07-22 03:19:04

firecat53
Member
From: Lake Stevens, WA, USA
Registered: 2007-05-14
Posts: 1,542
Website

Re: After python2-cherrypy update, Calibre web server stops working

I'm not using the user/password from the calibre server, either...I can't remember why, though! I think it was because some of the mobile ebook readers I tried had issues with the authentication. I use lighttpd with http digest authentication in front of calibre-server.

Scott

Offline

Board footer

Powered by FluxBB