Problem with running bot locally


#1

Everytime I try to run the bot online it works fine. However, when i try to run the same code offline I keep recieving this error message:

Turn 1

error: communication error with bot: Problem writing to pipe, errno was: 0 (No error)
Last input received was:

operable program or batch file.

Is there a fix to this?


#2

Can you post the exact command you’re running? Also, which language is your bot written in?


#3

Sure. I’m using python and I’m trying to use the windows-batchfile to try and run the game.

Right now i am trying to execute the basic python code given by Halite that is already premade when you download it, with a single line of logging code added:
“logging.info(“Ship {} has {} halite.”.format(ship.id, ship.halite_amount))”

Not sure what you mean when you say what “command” I’m running?


#4

Try without first and last " like here:
logging.info(“Ship {} has {} halite.”.format(ship.id, ship.halite_amount))


#5

Open cmd and type python -V. If it is 3.6+ then try python MyBot.py. If it do nothing (wait endlessly for input) then it’s alright. Also ensure that your directory contains halite.exe, hlt directory and MyBot.py.


#6

Well it already is like that, i just wanted to highlight that it was a piece of code


#7

Python is 3.6.6. And when i run the code it does just wait endlessly waiting for input.

However the problem with logging the games still persist. I always seems to quit after round 1 when i execute the run_game batchfile


#8

If there is something with code then it should give some traceback, some error info. Problem writing to pipe, errno was: 0 (No error) I also see this problem few times and it is usually some path problem (wrong working directory, wrong arguments in sunproccess.Popen, etc.). Try to run this directly from cmd:
halite.exe --replay-directory replays/ -vvv --width 32 --height 32--"no-timeout" "python MyBot.py" "python MyBot.py"


#9

Regarding the “command” terminology - the Windows batch file is the command in this case, and it contains the real command which invokes the Halite binary, which is (probably still):

halite.exe --replay-directory replays/ -vvv --width 32 --height 32 "python MyBot.py" "python MyBot.py"

If you haven’t got it working, the next thing to try is probably to run this command with the unmodified starter package. If that works, it’s then just a matter of working out what’s wrong with the changes to the starter (e.g some editors insert tab characters instead of spaces for indentation, and if it isn’t consistent throughout the program, Python will complain).