Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Runtime warning, then importing python libtorrent module (RC_1_1) #1217

Closed
barmalej2 opened this issue Oct 15, 2016 · 9 comments
Closed

Runtime warning, then importing python libtorrent module (RC_1_1) #1217

barmalej2 opened this issue Oct 15, 2016 · 9 comments

Comments

@barmalej2
Copy link

libtorrent version (or branch):RC_1_1 git branch
boost version: 1.61.0
python version: 2.7.12
platform/architecture: armv5tel GNU/Linux, kernel 2.6.31.8
compiler and compiler version: gcc 4.9.2,
Step to reproduce case. Import python libtorrent:
python -c "import libtorrent; print libtorrent.version"
Expected output is only libtorrent version.
Actual output is:

-c:1: RuntimeWarning: to-Python converter for boost::shared_ptrlibtorrent::alert already registered; second conversion method ignored.
1.1.1.0

@cas--
Copy link
Contributor

cas-- commented Oct 17, 2016

A little research turned up this project encountering the same issue and seems to due to boost version differences.

@barmalej2
Copy link
Author

barmalej2 commented Oct 28, 2016

Maybe this info can be useful:
http://stackoverflow.com/questions/9888289/checking-whether-a-converter-has-already-been-registered
I would like to draw attention of libtorrent devs to this minor, but irritative issue.

@arvidn
Copy link
Owner

arvidn commented Oct 28, 2016

iirc, the underlying problem is that different version of boost.python or perhaps when building against different versions of python (2 vs. 3) has different behavior here. A while ago I spent quite some time trying to resolve this. as far as I know, at least I got it to work everywhere.

However, the long term solution is to get rid of the shared_ptr<> as part of the API, which puts all of this to reset once and for all. This is already the case in master and will be the fix in the next major release. I am open to patches that fixes this warning in the 1.1 branch, but I'm not sure I'm prepared to put much more work into it myself.

@Falcosc
Copy link
Contributor

Falcosc commented Dec 29, 2016

@barmalej2 What did you think about it? I don't like the idea of changing the RC_1_1 api to solve this issue. And it would may be take more effort than switching your python scripts to libtorrent 1.2.

@cas--
Copy link
Contributor

cas-- commented Dec 29, 2016

The problem here is why is this occuring only in certain Linux configurations... I.e. I don't see this on my Ubuntu systems but iirc it's seen on Arch

@Falcosc
Copy link
Contributor

Falcosc commented Dec 29, 2016

I would guess because on the seen Arch system there was a boost version difference. But I don't know.

@arvidn
Copy link
Owner

arvidn commented Jan 6, 2017

would it make sense to remove the problematic alert-binding for the upcoming RC_1_1 release? That way at least some other deprecated functions could be preserved

@cas--
Copy link
Contributor

cas-- commented Jan 7, 2017

It seems this is occurring with boost >=1.61 as I can replicate this on Ubuntu Yaketty.

@arvidn did you see this workaround that caffe used: https://github.com/BVLC/caffe/pull/3866/files

There are two instances of register_ptr_to_python:

Also the boost version check doesn't exist in torrent_info.cpp so is the usage in alert.cpp correct?

cas-- added a commit to cas--/libtorrent that referenced this issue Jan 14, 2017
For Boost >=1.60 the following warning is output importing libtorrent in Python:

    RuntimeWarning: to-Python converter for boost::shared_ptrlibtorrent::alert already registered; second conversion method ignored.
cas-- added a commit to cas--/libtorrent that referenced this issue Jan 14, 2017
This fix checks for existing registered pointers for alert so that Boost
does not output the following warning when importing libtorrent in Python:

> RuntimeWarning: to-Python converter for boost::shared_ptrlibtorrent::alert already registered; second conversion method ignored.
arvidn pushed a commit that referenced this issue Jan 15, 2017
This fix checks for existing registered pointers for alert so that Boost
does not output the following warning when importing libtorrent in Python:

> RuntimeWarning: to-Python converter for boost::shared_ptrlibtorrent::alert already registered; second conversion method ignored.
@barmalej2
Copy link
Author

barmalej2 commented Feb 24, 2017

Thank you guys for your efforts and time spending to resolve this. Tested with latest libtorrent-1.1.2_git3b359ab (RC_1_1) and boost 1.63.0. No more runtime warnings. Closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants