Discussion:
[libtorrent] RuntimeWarning: to-Python converter for
Ronald Degmar
8 years ago
Permalink
Hello,

I installed boost and libtorrent in Python virtualenv. Then I installed
Deluge.
This works fine. I want to do new python code and what is reallly annoying
is the fact I get a warning everytime I import libtorrent.
See:

***@systorzo:~/AcademicTorrents$ source bin/activate
(AcademicTorrents) ***@systorzo:~/AcademicTorrents$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import libtorrent as lt
__main__:1: RuntimeWarning: to-Python converter for
boost::shared_ptr<libtorrent::alert> already registered; second conversion
method ignored.
lt.version
'1.0.10.0'
How do I get rid of this warning,

Best,

Ronald Barrios
Calum Lind
8 years ago
Permalink
https://github.com/arvidn/libtorrent/issues/1217
...
Ronald Degmar
8 years ago
Permalink
Hi Calum,

I'm working hard on this. I read your previous answers with the links you
provided. I can't figure it out yet how to change the source code in order
to get rid of the warning. I'd rather not modify it. Is it possible to work
with b2 or bjam in libtorrent, get the same configure options as below, and
get rid of the warning?

*Libtorrent:*

*./configure --enable-python-binding --disable-dependency-tracking
--disable-silent-rules PYTHON=${PY}/python --prefix=${AT_HOME}
--with-boost=${AT_HOME} --with-libiconv --with-boost-python=boost_python
BOOST_ROOT=\"${PKG}/${_BOOST_DIR}\""*

I mean possibly to give standalone features for boost, libtorrent, and
deluge in python virtual env.

I tested docker images in Gitlab for Ubuntu, Debian, Fedora and Centos.
Deluge installation passed successfully in ubuntu and debian despite of the
warning, whereas it crashed in Centos and Fedora while importing libtorrent:

*/builds/ronald.degmar/ATdev/packages/deluge-1.3.13/deluge/_libtorrent.py:59:
RuntimeWarning: to-Python converter for
boost::shared_ptr<libtorrent::alert> already registered; second conversion
method ignored.*
* import libtorrent as lt*
*invalid command name ''*

Ronald
...
Calum Lind
8 years ago
Permalink
It's actually been fixed now
...
Ronald Degmar
8 years ago
Permalink
That's amazing Calum! Do you mean a new release, say libtorrent 1.0.11?

Ronald
...
Ronald Degmar
8 years ago
Permalink
Hi Calum,

Finally the problem is solved. I got rid of the warning. Solution was
simpler than I thought:

The following python code helped to suppress the warning:

*import warnings*
*with warnings.catch_warnings():*
* warnings.simplefilter("ignore")*
* import libtorrent as lt*
*print('Libtorrent Version Installed is: ' + lt.version*)


Ouput is as follows:

*Libtorrent Version Installed is: 1.0.10.0*

As you see there are no warnings. As speaking about deluge, installation
failed in Centos and Fedora because of an issue I had with
pyhon-setuptools. It was not because of libtorrent.

Just a quick question. Is there a test I can run for libtorrent to check
library is fully functional and working OK? I haven't gotten around that
yet. What would be the best way to do it?

Regards,

Ronald Barrios
...
Calum Lind
8 years ago
Permalink
Thanks for the update, I knew it would be possible to hide the warning but
I knew it wouldn't fix it so didn't bother :)

To test if libtorrent is available for Deluge, the python import and
version check will suffice.

To test libtorrent itself you would build and run with the included tests.
`./configure --enable-tests`
...
Loading...