CAIDA / bgpstream

BGP measurement analysis for the masses
GNU General Public License v2.0
109 stars 43 forks source link

TypeError: cannot create '_pybgpstream.BGPRecord' instances #101

Closed ByungjinJun closed 4 years ago

ByungjinJun commented 4 years ago

Hi,

The above error shows up when I run the test with PyGBPStream; $ curl https://raw.githubusercontent.com/CAIDA/bgpstream/v1.2.3/pybgpstream/examples/tutorial_print.py | python

That shows up in both python2/3, and my OS is macOS Catalina 10.15.1.

I installed packages in default locations following the recommendation in https://github.com/CAIDA/bgpstream/issues/98.

I followed the instructions getting each lib from sources (git clone); libbgpstream from; https://github.com/CAIDA/libbgpstream/tree/158ebb378fae20997a84a6861cdd4832baeedd1d

and pybgpstream from; https://github.com/CAIDA/pybgpstream/tree/a7ed005326589291a16c02879e90c8d02cecc29f

I checked _pybgpstream.py file in the following location /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pybgpstream-2.0.0-py3.7-macosx-10.15-x86_64.egg/_pybgpstream.py

and found that it contains only __bootstrap function.

I tried to import pybgpstream instead of _pybgpstream, and it returns another error; TypeError: init() takes exactly 2 arguments (1 given) for BGPRecord()

Am I getting wrong version? I ended up with the above instruction, which seems to be the newest after I failed in several way with the official versions in https://bgpstream.caida.org.

digizeph commented 4 years ago

Hey @ByungjinJun

Thank you for using BGPStream! We are currently in the process of updating the documentation and tutorials for libbgpstream and pybgpstream. Unfortunately, the tutorial_print.py is still outdated.

Can you try this template script instead? https://github.com/CAIDA/pybgpstream/blob/v2.0/examples/pybgpstream-template.py This script has the updated/improved syntax for easier config and filter the stream. The following command should work:

curl https://raw.githubusercontent.com/CAIDA/pybgpstream/v2.0/examples/pybgpstream-template.py|python
ByungjinJun commented 4 years ago

Hi @digizeph,

Thank you for your swift answer!

The provided command indeed works. Does that mean my installation is fine?

As the instruction is outdated, should I just use pybgpstream following your template? When would the complete tutorial would be done, then?

Thanks,

digizeph commented 4 years ago

Ya, your installation is fine, but potentially still a bit outdated. To get the most recent releases, please do the following:

We will update the website and tutorials this week. In the meantime, you can follow the template and tweak as you wish, it should be mostly straightforward to use the template script. If you have further questions, please feel free to leave a comment here or contact us at bgpstream-info@caida.org.

ByungjinJun commented 4 years ago

Thank you for your help!