Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pictionary - Exception seen in BackgroundTask.run function #48

Open
pratham-darooka opened this issue Sep 24, 2024 · 0 comments
Open

Pictionary - Exception seen in BackgroundTask.run function #48

pratham-darooka opened this issue Sep 24, 2024 · 0 comments

Comments

@pratham-darooka
Copy link

Logs:

##############################################################
[]

##############################################################
Error in run function: [Errno 21] Is a directory: '/Users/prathamdarooka/Desktop/pictionary-ai'

with code:

    def run(self):
        # Debug info
        if self.game_idx is None:
            if thread_debug: print(f"Task {self.task_name} is starting with func {self.func}")
        else:
            if thread_debug: print(f"Task {self.task_name} is starting for game {self.game_idx} with guesser {self.func}")

        # Run in loop
        while not self.stop_event.is_set():
            start_time = time.time()
            if thread_debug: print(f"Task {self.task_name} is running")
            if self.game_idx is None:
                self.func()
            else:
                # Threads do nothing if there are not enough active games
                if self.game_idx >= len(active_games):
                    time.sleep(1)
                    continue
                # Get game info
                game = active_games[self.game_idx]
                image_fn  = ""
                if game.last_drawing:
                    with db_lock:
                        drawing = drawings[game.last_drawing]
                        image_fn = drawing.fn
                guess_history = guesses(where=f"game == {game.id}")
                guess_history = [{'guesser': g.guesser, 'guess': g.guess} for g in guess_history]
                word = game.word
                game_id = game.id
                try:
                    if thread_debug: print(f"Game idx {self.game_idx} is running for game {game_id} with word {word}, image {image_fn}")
                    print("##############################################################")
                    print(guess_history)
                    print(image_fn)
                    print("##############################################################")
                    guess = self.func(image_fn, guess_history) # this is erroneous

app runs fine but can something be done to not hit the except block always?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant