pnxenopoulos / awpy

Python library to parse, analyze and visualize Counter-Strike 2 data
http://www.awpycs.com
MIT License
374 stars 57 forks source link

awpy.visualization.plot.plot_round: TypeError: The keyword `fps` is no longer supported. #236

Closed gerelef closed 1 year ago

gerelef commented 1 year ago

Describe the bug Ran something similar to the example provided here. Expected a gif output of player movements, however it threw an exception and exited abnormally. From the detailed description provided by pillow, I gather that the formerly fps value has been removed and been replaced by duration.

Snippet:

import awpy
from awpy.visualization.plot import plot_round

data = awpy.DemoParser(
    demofile="vitality-vs-into-the-breach-m1-vertigo.dem"
).parse()

plot_round("best_round_ever.gif", data["gameRounds"][7]["frames"], map_name=data["mapName"], map_type="simpleradar", dark=False)

Additional context Linux, Fedora 37. Latest version of awpy from pip as of writing. go version go1.19.9 linux/amd64

Match demo is here.

Stacktrace:


80it [00:50,  1.58it/s]
Traceback (most recent call last):
  File "/home/user/random/awpy-test/main.py", line 9, in <module>
    plot_round("best_round_ever.gif", data["gameRounds"][7]["frames"], map_name=data["mapName"], map_type="simpleradar", dark=False)
  File "/home/user/random/awpy-test/venv/lib64/python3.11/site-packages/awpy/visualization/plot.py", line 257, in plot_round
    imageio.mimsave(filename, images, fps=fps)
  File "/home/user/random/awpy-test/venv/lib64/python3.11/site-packages/imageio/v2.py", line 484, in mimwrite
    return file.write(ims, is_batch=True, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/random/awpy-test/venv/lib64/python3.11/site-packages/imageio/plugins/pillow.py", line 354, in write
    raise TypeError(
TypeError: The keyword `fps` is no longer supported. Use `duration`(in ms) instead, e.g. `fps=50` == `duration=20` (1000 * 1/50).```
JanEricNitschke commented 1 year ago

This is due to a change of imageio and is fixed on the current main branch and will be included in the next release. Until then you can work around this issue by pip installing an older release of imageio.

I will also change the requirements from using >= to == so that doesnt randomly happen in the future anymore.

gerelef commented 1 year ago

Looks like a plan! I'll close this issue since it's fixed on the main branch.