bitkeks / python-netflow-v9-softflowd

PyPI "netflow" package. NetFlow v9 parser, collector and analyzer implemented in Python 3. Developed and tested with softflowd
https://bitkeks.eu/blog/2016/08/collecting-netflow-v9-on-openwrt.html
MIT License
108 stars 55 forks source link

version 0.12.1 causes "TypeError: unsupported operand type(s) for |: 'type' and 'type' " #47

Closed jsofri closed 10 months ago

jsofri commented 10 months ago

Hi I have a nightly process that installs the latest netflow version and then run some functionality.
I noticed that yesterday a new version was released. Today, my nightly process installed the latest version (0.12.1) and started my script. I got the following exception:

  File "/tmp/my_script.py", line 12, in <module>
    import netflow
  File "/usr/local/lib/python3.8/dist-packages/netflow/__init__.py", line 10, in <module>
    from .utils import parse_packet
  File "/usr/local/lib/python3.8/dist-packages/netflow/utils.py", line 13, in <module>
    from .ipfix import IPFIXExportPacket
  File "/usr/local/lib/python3.8/dist-packages/netflow/ipfix.py", line 935, in <module>
    class IPFIXExportPacket:
  File "/usr/local/lib/python3.8/dist-packages/netflow/ipfix.py", line 974, in IPFIXExportPacket
    def flows(self) -> list[IPFIXTemplateRecord | IPFIXOptionsTemplateRecord | IPFIXDataRecord]:
TypeError: unsupported operand type(s) for |: 'type' and 'type'

The quick fix I made was using the previous version 0.11.3.

I noticed this recent commit that should fix the issue, but there is no new version released. Is there an upcoming release planned?

bitkeks commented 10 months ago

Hi, yes, sorry for this. There was an issue yesterday with release v0.12.0 that I wanted to fix as quickly as possible. Sadly, the 0.12.1 went out before the test suite showed the error. Thanks for the quick report, I'll release a new patch version now.

bitkeks commented 10 months ago

Release v0.12.2 is the corresponding hotfix release. It is published via PyPI at https://pypi.org/project/netflow/0.12.2/ and can be fetched as dependency.

Hope this solves your problem. I wasn't aware the lib breaks someone's nightly tool chain 😄

If you don't mind, what's your tool doing that you fetch new releases every night?

Please close the issue if the new release resolved it.

bitkeks commented 10 months ago

And for reference, if someone else stumbles upon this issue: the releases v0.12.0 and v0.12.1 were yanked from PyPI and should be skipped.

jsofri commented 10 months ago

Thanks for the quick response. Actually there is nothing special about this nightly, just no version was specified so far ☺️ Closing this issue