Import hlt statement crashes script


#1

Hello,

Today i found out about this site and i immediatelystarted to play around with it. the only problem i have is that as soon as the python script for my bor is started it returns an error on the first line. the first line contains the import htl statement.
the game log is below. i am using python version 3.6.4 (added to PATH)

Game constants: all default
Seed: 841095004 Dimensions: 240x160
Init Message sent to player 0.
Init Message sent to player 1.
Init Message received from player 0, Traceback (most recent call la.
Init Message received from player 1, Traceback (most recent call la.
Turn 1
ERROR: Bot #0: Received invalid character ' File "MyBot.py", line 1, in F'. (at character 3.)
Input received from bot:
File "MyBot.py", line 1, in
^
ERROR: Bot #1: Received invalid character ' File "MyBot.py", line 1, in F'. (at character 3.)
Input received from bot:
File "MyBot.py", line 1, in
^
Player 0 is dead
Player 1 is dead
Skipping replay (bot errored on first turn).
Player #0, Traceback (most recent call la, came in rank #2 and was last alive on frame #0, producing 0 ships and dealing 0 damage!
Player #1, Traceback (most recent call la, came in rank #1 and was last alive on frame #0, producing 0 ships and dealing 0 damage

!https://i.gyazo.com/d272459a7c8800e01f77a133ff76671a.png


#2

Check/upload the .log file created (in the same directory).
Also make sure that you are not taking more than 2 seconds each turn to return a reply.


#3

the site wont let me upload .log fuiles so hetre is the raw text:

[
{
"Error": {
"Message": "ERRORED! Got Exception (if any): ERROR: Bot #0: Received invalid character ' File \"MyBot.py\", line 1, in F'. (at character 3.)\nInput received from bot:\n File \"MyBot.py\", line 1, in \n ^; Response received (if any): File \"MyBot.py\", line 1, in import hlt File \"C:\Users\pasca\Downloads\HalitePython\hlt\init.py\", line 9, in from . import collision, constants, entity, game_map, networking File \"C:\Users\pasca\Downloads\HalitePython\hlt\collision.py\", line 4 def intersect_segment_circle(start, end, circle, *, fudge=0.5): ^SyntaxError: invalid syntax",
"Turn": 1
},
"Frames": [
{
"Time": 97,
"Turn": 0
},
{
"Time": 0
}
],
"PlayerID": 0,
"PlayerName": "Traceback (most recent call la"
},
{
"Error": {
"Message": "ERRORED! Got Exception (if any): ERROR: Bot #1: Received invalid character ' File \"MyBot.py\", line 1, in F'. (at character 3.)\nInput received from bot:\n File \"MyBot.py\", line 1, in \n ^; Response received (if any): File \"MyBot.py\", line 1, in import hlt File \"C:\Users\pasca\Downloads\HalitePython\hlt\init.py\", line 9, in from . import collision, constants, entity, game_map, networking File \"C:\Users\pasca\Downloads\HalitePython\hlt\collision.py\", line 4 def intersect_segment_circle(start, end, circle, *, fudge=0.5): ^SyntaxError: invalid syntax",
"Turn": 1
},
"Frames": [
{
"Time": 106,
"Turn": 0
},
{
"Time": 0
}
],
"PlayerID": 1,
"PlayerName": "Traceback (most recent call la"
}
]


#4

also i dont think the script i have right now is even close to hitting 2 seconds..:

import hlt
import logging
from collections import OrderedDict

game = hlt.Game("Naugrim00-V1")
logging.info("Booting up Naugrim00")

while True:
game_map = game.update_map()
command_queue = []

team_ships = game_map.get_me().all_ships()

for ship in team_ships:
    shipid = ship.id
    if ship.docking_status != ship.docking_status.UNDOCKED:
        continue

    entities_by_distance = game_map.nearby_entities_by_distance(ship)
    entities_by_distance = OrderedDict(sorted(entities_by_distance.items(), key=lambda t: t[0]))

    closest_empty_planets = [entities_by_distance[distance][0] for distance in entities_by_distance if isinstance(entities_by_distance[distance][0], hlt.entity.Planet) and not entities_by_distance[distance][0].is_owned()]
    closest_empty_ships = [entities_by_distance[distance][0] for distance in entities_by_distance if isinstance(entities_by_distance[distance][0], hlt.entity.Ship) and entities_by_distance[distance][0] not in team_ships]

    if len(closest_empty_planets) > 0:
        target_planet = closest_empty_planets[0]

        if ship.can_dock(target_planet):
            command_queue.append(ship.dock(target_planet))
        else:
            navigate_command = ship.navigate(
                ship.closest_point_to(target_planet),
                game_map,
                speed = int(hlt.constants.MAX_SPEED),
                ignore_ships=False)
            if navigate_command:
                command_queue.append(navigate_command)

    elif len(closest_empty_ships) > 0:
        target_ship = closest_empty_ships[0]

        navigate_command = ship.navigate(
            ship.closest_point_to(target_ship),
            game_map,
            speed=int(hlt.constants.MAX_SPEED),
            ignore_ships=False)
        if navigate_command:
            command_queue.append(navigate_command)
game.send_command_queue(command_queue)

.


#5

Resolve the syntax error as indicated in the log file.