Code Monkey home page Code Monkey logo

Comments (4)

ana-gonzalezrios avatar ana-gonzalezrios commented on June 14, 2024

When trying to convert MRT file <updates.20030201.0023.bz2> I get the following error:

[
Traceback (most recent call last):
File "mrt2json.py", line 16, in
main()
File "mrt2json.py", line 8, in main
for entry in Reader(sys.argv[1]):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mrtparse/init.py", line 86, in next
self.unpack_hdr(mrt)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mrtparse/init.py", line 116, in unpack_hdr
mrt.unpack()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/mrtparse/init.py", line 229, in unpack
MRT_ST[self.data['type'][0]][self.data['subtype'][0]]
KeyError: 22864

File can be downloaded from:
http://archive.routeviews.org/bgpdata/2003.02/UPDATES/updates.20030201.0023.bz2

from mrtparse.

t2mune avatar t2mune commented on June 14, 2024

Hi,

Thank you for using mrtparse ❗
In my environment, there were no errors.
Could you tell me which version you are using ❓

$ python3 -c "import mrtparse; print(mrtparse.__version__)"
2.1.0
$ mrt2json.py updates.20030201.0023.bz2
[
  {
    "timestamp": {
      "1044087837": "2003-02-01 17:23:57"
    },
    "type": {
      "16": "BGP4MP"
    },
    "subtype": {
      "1": "BGP4MP_MESSAGE"
      (...snip)
      ],
      "nlri": [
        {
          "prefix_length": 24,
          "prefix": "203.196.244.0"
        }
      ]
    }
  }
]

from mrtparse.

ana-gonzalezrios avatar ana-gonzalezrios commented on June 14, 2024

I am running mrtparse 2.0.1 in python 3.10.2 and macOS 12.2.1

from mrtparse.

t2mune avatar t2mune commented on June 14, 2024

I changed the version and tried it, but there was no problem...

$ python -c 'import mrtparse; print(mrtparse.__version__)'            
2.0.1
$ ./mrt2json.py updates.20030201.0023.bz2
[
  {
    "timestamp": [
      1044087837,
      "2003-02-01 17:23:57"
    ],
    "type": [
      16,
      "BGP4MP"
    ],
    (...snip)
      ],
      "nlri": [
        {
          "prefix_length": 24,
          "prefix": "203.196.244.0"
        }
      ]
    }
  }
]

Your download data might be broken, so could you check the checksum ❓
In my environment, the checksum is as follows:

$ md5sum updates.20030201.0023.bz2                                    
2e15294482ff06f580fc4d6c218a3128  updates.20030201.0023.bz2

from mrtparse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.