snstac / stratuxcot

stratuxcot - Stratux Cursor on Target Gateway
Other
13 stars 4 forks source link

ValueError: invalid literal for int() with base 16: '0x' #2

Closed ampledata closed 2 years ago

ampledata commented 3 years ago
exception=ValueError("invalid literal for int() with base 16: '0x'")>
Traceback (most recent call last):
  File "/home/gba/.local/lib/python3.7/site-packages/stratuxcot/classes.py", line 64, in run
    await self.handle_message(j_event)
  File "/home/gba/.local/lib/python3.7/site-packages/stratuxcot/classes.py", line 40, in handle_message
    classifier=self.cot_classifier
  File "/home/gba/.local/lib/python3.7/site-packages/stratuxcot/functions.py", line 142, in stratux_to_cot
    cot_type = classifier(icao_hex, emitter_category, flight)
  File "/home/gba/.local/lib/python3.7/site-packages/pytak/functions.py", line 192, in faa_to_cot_type
    icao_int = int(f"0x{icao_hex.replace('~', '')}", 16)
ValueError: invalid literal for int() with base 16: '0x'
ampledata commented 3 years ago

Fixed by adding a conditional to check for int or str.