Skip to content

(Keyboard)Interupt doesn't get propagated correctly #4

Closed

Description

@donmahallem

The following will run indefinitely. If an KeyboardInterupt is issued the WebSocket-Transmission will stop but the program will not end. When logging with Verbosity.ALL it will show no further transmission after the first KeyboardInterupt but the whole script won't shutdown.

from pyghthouse import Pyghthouse,VerbosityLevel
from login import username, token
from random import randint
import colorsys
p = Pyghthouse(username, token)
p.start()

img = Pyghthouse.empty_image()
p.set_image(img)
dir_factor=10
dirs=[(0,1),(1,0),(0,-1),(-1,0)]
cur=(0,0)
cur_hue=0
while True:
    cur_x,cur_y=cur
    while True:
        rand_dir_x,rand_dir_y=dirs[randint(0,3)]
        next_x,next_y=cur_x+rand_dir_x,cur_y+rand_dir_y
        if next_x>=0 and next_y>=0 and next_x<28 and next_y<14:
            break
    next_hue=(cur_hue+1)%360
    img[next_y][next_x]=tuple(round(i * 255) for i in colorsys.hsv_to_rgb(next_hue/360.0,1,1))
    cur=(next_x,next_y)
    cur_hue=next_hue
    p.set_image( img)

Activity

  1. linked a pull request that will close this issueFixes termination issues regarding #4 #5on Apr 16, 2025
  2. linked a pull request that will close this issueRefactor core #6on May 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions