ggtracker/sc2reader

context.py errors

Andrene opened this issue · 1 comments

It looks like a couple of the handleXEvent functions in there use event.killer_pid on events that dont have that attribute. Curious if theres a reason for that, or if its an oversight from copy-pasting functions.

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sc2reader\factories\sc2factory.py", line 85, in load_replay
    return self.load(Replay, source, options, **new_options)
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sc2reader\factories\sc2factory.py", line 143, in load
    return self._load(cls, resource, filename=filename, options=options)
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sc2reader\factories\sc2factory.py", line 152, in _load
    obj = cls(resource, filename=filename, factory=self, **options)
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sc2reader\resources.py", line 346, in __init__
    engine.run(self)
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sc2reader\engine\engine.py", line 178, in run
    for new_event in event_handler(event, replay) or []:
  File "C:\Users\xxx\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\sc2reader\engine\plugins\context.py", line 328, in handleUnitPositionsEvent
    event.killer_pid, Length(seconds=event.second), event.frame
AttributeError: 'UnitPositionsEvent' object has no attribute 'killer_pid'

I'll submit a PR to fix if its not intended
See replay here bad.zip