Bug 238015 - [PATCH] deskutils/calibre: fix Typeerror: unpackb() got an unexpected keyword argument 'raw'
Summary: [PATCH] deskutils/calibre: fix Typeerror: unpackb() got an unexpected keyword...
Status: Closed Not A Bug
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Guido Falsi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-05-21 08:16 UTC by Thibault Payet
Modified: 2019-05-21 09:33 UTC (History)
0 users

See Also:
madpilot: maintainer-feedback+


Attachments
simple remove of raw keyword argument (1.43 KB, patch)
2019-05-21 08:16 UTC, Thibault Payet
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thibault Payet 2019-05-21 08:16:13 UTC
Created attachment 204503 [details]
simple remove of raw keyword argument

When launching calibre I get an error about wrong kargs keyword : raw
So I am not sure if I have some issue with my python installation or if it is not working for others, so this is more a call for running calibre to see if other came to the same issue.
Here are a patch that fix the issue for me.
Comment 1 Guido Falsi freebsd_committer freebsd_triage 2019-05-21 08:30:59 UTC
Hi,

Thanks for reporting this.

Calibre is a big python code base and it's difficult to evaluate your patch right away.

I checked the msgpack github home page. It's interesting that the raw argument to 
msgpack.unpackb is used n the very first example in their readme file.

Could you please describe what you ere doing when the error happened for you? This could help reproduce the problem.

Also, could you try forcing reinstallation of the py27-msgpack port/package? Maybe there's something wrong with that package on your system.

You can do that with pkg upgrade -f py27-msgpack if using binary packages. Using ports you'll have to use the FORCE_PKG_REGISTER flag.

Also, you should make sure all your packages are at the latest version.
Comment 2 Guido Falsi freebsd_committer freebsd_triage 2019-05-21 08:32:09 UTC
Forgot to mention, I do use calibre almost daily and have experienced no problems. This is no proof there is no problem, I know that well, but I need help reproducing or identifying the problem, since I can't see it first hand!
Comment 3 Thibault Payet 2019-05-21 08:49:24 UTC
I did a force reinstall on py27 msgpack

So I check the mini tutorial for msgpack, and interestingly the tutorial work when using python3 (3.6.8 for instance), but then fail for python2 (2.7.16).

Note that my default python is 3
python --version
Python 3.6.8



For python 3

Python 3.6.8 (default, Apr 11 2019, 01:15:24) 
[GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import msgpack
>>> msgpack.packb([1, 2, 3], use_bin_type=True)
b'\x93\x01\x02\x03'
>>> msgpack.unpackb(_, raw=False)
[1, 2, 3]
>>> exit()

For python 2

Python 2.7.16 (default, Apr 11 2019, 01:14:48) 
[GCC 4.2.1 Compatible FreeBSD Clang 6.0.1 (tags/RELEASE_601/final 335540)] on freebsd12
Type "help", "copyright", "credits" or "license" for more information.
>>> import msgpack
>>> msgpack.packb([1, 2, 3], use_bin_type=True)
'\x93\x01\x02\x03'
>>> msgpack.unpackb(_, raw=False)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "msgpack/_unpacker.pyx", line 100, in msgpack._unpacker.unpackb (msgpack/_unpacker.cpp:1777)
TypeError: unpackb() got an unexpected keyword argument 'raw'


Maybe I have some issue with local install of pip packages, but I do not know how to quickly mark user pip package unavailable.

I tested on another computer (aarch64 ) and the python2 version works,
note that for the second computer the default python version is 2.

So It may that having python3 as the default break msgpack in version2 or it is just my pip packages that are an issue
Comment 4 Thibault Payet 2019-05-21 09:10:52 UTC
Solved,

I had a mspack installation in $HOME/.local that did not have the raw kargs, (and that was not see by pip for unknown reason).

by removing it the msgpack unpackb work with the raw argument, and so is calibre.
Comment 5 Guido Falsi freebsd_committer freebsd_triage 2019-05-21 09:20:38 UTC
(In reply to Thibault Payet from comment #4)
> Solved,
> 
> I had a mspack installation in $HOME/.local that did not have the raw kargs,
> (and that was not see by pip for unknown reason).
> 
> by removing it the msgpack unpackb work with the raw argument, and so is
> calibre.

That explains the problem, so this can be closed?

As further explanation:

Calibre only works with python2. Upstream is working on moving to python3, but at present support is very experimental.

The ports tree has support to install python2 and python3 (both the language and the packages) in parallel, and the Calibre port takes advantage of that, making sure it's python2 dependencies are installed correctly.

If other tools (like pip) are used to install python parts things could conflict. Unluckily there is no way around this that I know of.

I hope upstream will soon produce a python3 enabled version so I can move the Calibre port to python3 and align with the ports tree default.
Comment 6 Thibault Payet 2019-05-21 09:25:33 UTC
This can be closed of course. Thanks for the quick response
Comment 7 Guido Falsi freebsd_committer freebsd_triage 2019-05-21 09:33:12 UTC
Closed since problem was caused by locally installed pip packages.