ggtracker / sc2reader

Extracts gameplay information from Starcraft II replay files
http://pypi.python.org/pypi/sc2reader
MIT License
145 stars 144 forks source link

SC2READER_CACHE_MAX_SIZE should be a string, not an integer #114

Open GBathie opened 4 years ago

GBathie commented 4 years ago

The example (in the readme) suggests to write os.environ['SC2READER_CACHE_MAX_SIZE'] = 100. This does not work (at least for me, Python 3.6.9) : environment variables are supposed to be strings (throws a TypeError).

When set to string, this causes an error in sc2reader because of a comparison between a string and an integer (sc2factory.py line 315).

cclauss commented 4 years ago

Does os.environ['SC2READER_CACHE_MAX_SIZE'] = '100' work?

GBathie commented 4 years ago

It does not, I get a TypeError from sc2reader:

File ".../.local/lib/python3.6/site-packages/sc2reader/factories/sc2factory.py", line 315, in cache_set
    if self.cache_max_size and len(self.cache_dict) >= self.cache_max_size:
TypeError: '>=' not supported between instances of 'int' and 'str'
cclauss commented 4 years ago

Please search for SC2READER_CACHE_MAX_SIZE and wrap it in int() whenever we get it.