Dentosal / python-sc2

A StarCraft II bot api client library for Python 3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TypeError in distribute_workers

B204L opened this issue · comments

Using the latest develop branch and forking the template for overmind-challenge and using the same folder / file structure. I am using the run_locally.py script in the root folder for testing, my bot files are inside the bot directory and I'm using the default MyBot class.

Traceback (most recent call last):

File "C:\Program Files (x86)\Python37-32\lib\site-packages\sc2\main.py", line 166, in _play_game_ai await ai.on_step(iteration)

File "C:\Users\justin\Documents\sc2ai\overmind-challenge\bot\main.py", line 50, in on_step await self.distribute_workers(self)

File "C:\Program Files (x86)\Python37-32\lib\site-packages\sc2\bot_ai.py", line 357, in distribute_workers if self.vespene and self.minerals / self.vespene < resource_ratio:

TypeError: '<' not supported between instances of 'float' and 'MyBot'

ERROR:sc2.main:Error: '<' not supported between instances of 'float' and 'MyBot'

I am using await self.distribute_workers(self) in the on_step, TypeError occurs momentarily after geysers are built.

Python 3.7.3

In await self.distribute_workers(self) it appears you pass in your bot object as a function argument.

Instead, you should pass in a number, e.g.
await self.distribute_workers(resource_ratio=2)
or just leave it empty await self.distribute_workers()

Feel free to join the discord, questions like these could be much more quickly answered there.

Thanks, will do in the future.