Bug 1471389 - calibredb unable to connect to the new Calibre 3 content server
calibredb unable to connect to the new Calibre 3 content server
Status: ASSIGNED
Product: Fedora
Classification: Fedora
Component: calibre (Show other bugs)
26
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Kevin Fenzi
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-15 10:14 EDT by Johannes Römer
Modified: 2017-07-22 18:05 EDT (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Johannes Römer 2017-07-15 10:14:11 EDT
Since version 3.0 Calibre includes a new Content server [1]. Trying to interface with this server using the command line tool calibredb leads to the following error:

$ calibredb search XXX --username XXX --password XXX --with-library "http://localhost:8080/#calibre-library"
Traceback (most recent call last):
  File "/usr/bin/calibredb", line 20, in <module>
    sys.exit(main())
  File "/usr/lib64/calibre/calibre/db/cli/main.py", line 250, in main
    return run_cmd(cmd, opts, args[1:], DBCtx(opts))
  File "/usr/lib64/calibre/calibre/db/cli/main.py", line 54, in run_cmd
    ret = m.main(opts, args, dbctx)
  File "/usr/lib64/calibre/calibre/db/cli/cmd_search.py", line 45, in main
    ids = dbctx.run('search', q)
  File "/usr/lib64/calibre/calibre/db/cli/main.py", line 188, in run
    return self.remote_run(name, m, *args)
  File "/usr/lib64/calibre/calibre/db/cli/main.py", line 208, in remote_run
    res = self.br.open_novisit(rq)
  File "/usr/lib/python2.7/site-packages/mechanize/_mechanize.py", line 199, in open_novisit
    return self._mech_open(url, data, visit=False, timeout=timeout)
  File "/usr/lib/python2.7/site-packages/mechanize/_mechanize.py", line 230, in _mech_open
    response = UserAgentBase.open(self, request, data)
  File "/usr/lib/python2.7/site-packages/mechanize/_opener.py", line 193, in open
    response = urlopen(self, req, data)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 344, in _open
    '_open', req)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 332, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 1142, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/lib/python2.7/site-packages/mechanize/_urllib2_fork.py", line 1115, in do_open
    h.request(req.get_method(), req.get_selector(), req.data, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1042, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib64/python2.7/httplib.py", line 1082, in _send_request
    self.endheaders(body)
  File "/usr/lib64/python2.7/httplib.py", line 1038, in endheaders
    self._send_output(message_body)
  File "/usr/lib64/python2.7/httplib.py", line 880, in _send_output
    msg += message_body
UnicodeDecodeError: 'utf8' codec can't decode byte 0x91 in position 0: invalid start byte

According to Kovid Goyal this is caused by an outdated version of python-mechanize [2]. Fedora still ships version 0.2.5 (which was released in 2011). As of today, the latest version is 0.3.5 [3].

Bug 1432447 already tracks new releases of python-mechanize, but nobody seems to care.

[1] https://calibre-ebook.com/new-in/twelve
[2] https://www.mobileread.com/forums/showpost.php?p=3520402&postcount=151
[3] https://github.com/python-mechanize/mechanize
Comment 1 Kevin Fenzi 2017-07-21 18:39:30 EDT
I have built new python-mechanize in rawhide, but it needs python-webencodings for tests, so I want to get that package added and used before pushing it to stable releses. Additionally I had to update python-html5lib and it also needs python-webencodings for tests. 

So, hopefully soon I will push all these to 26. 

I can confirm that rawhide is working with the calibredb now and the new mechanize.
Comment 2 Johannes Römer 2017-07-22 18:05:36 EDT
Yes, indeed, calibredb works as expected after installing the new mechanize and html5lib packages. Thank you very much!

Note You need to log in before you can comment on or make changes to this bug.