-
Notifications
You must be signed in to change notification settings - Fork 8
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
After and await seem to not work correctly #30
Comments
Here is the full python traceback:
|
I appreciate you finding all these issues! I’ll have them fixed soon |
Awesome, thanks! If you have any pointers i could also try to take one of these issues. I tried to start with the "await next" but didnt manage to properly understand all of the code yet. |
And just for reference, this is the program i am trying to run:
|
Made PRs to fix all of the others, but this one is still a bit too deep into complicated logic for me. |
I think i am making some progress: In the simple "mouseclick" example, the code Here seems to be going wrong. We have
And so the check seems to fail. But also this seems relevant. I think it needs to be an Adjusting that makes the example above run without an error but it prints 5 instead of 6. I now also changed this block to just always set the "next" value to |
Got it to generally work now. Now i am stuck on my larger program again. Whenever i perform a keyclick to make a move, the when check is performed BEFORE the board has been updated. Additionally, it seems to just go right back to waiting instead of continuing in my gameplay loop. Minimal example to reproduce:
This initially prints
print This seems to be due to this part here. This triggers the watcher before the actual assignment happens and the addition to the |
Sorry for the late reply (was on a break), but thank you for all the work you've done so far! I've merged all your other PRs, and it looks like your modifications to the code in the second to last reply are all spot on. Regarding your last reply, I agree on your description of where the bug is happening: when_watchers = get_code_from_when_statement_watchers(id(value_to_modify), when_statement_watchers)
for when_watcher in when_watchers: # i just wanna be done with this :(
if any([when_watcher == x for x in visited_whens]):
continue
condition, inside_statements = when_watcher
condition_val = evaluate_expression(condition, namespaces, async_statements, when_statement_watchers)
execute_conditional(condition_val, inside_statements, namespaces, when_statement_watchers)
visited_whens.append(when_watcher)
if not remaining_indexes: # perform actual assignment here
value_to_modify.assign_index(index, new_value)
else:
assign_variable_helper(value_to_modify.access_index(index), remaining_indexes) I think this could be alleviated by moving things so that it is: if not remaining_indexes: # perform actual assignment here
value_to_modify.assign_index(index, new_value)
else:
assign_variable_helper(value_to_modify.access_index(index), remaining_indexes)
when_watchers = get_code_from_when_statement_watchers(id(value_to_modify), when_statement_watchers)
for when_watcher in when_watchers: # i just wanna be done with this :(
if any([when_watcher == x for x in visited_whens]):
continue
condition, inside_statements = when_watcher
condition_val = evaluate_expression(condition, namespaces, async_statements, when_statement_watchers)
execute_conditional(condition_val, inside_statements, namespaces, when_statement_watchers)
visited_whens.append(when_watcher) Feel free to make all this into a PR (or let me know if there's another issue) if you want! |
Thanks a ton! And dont feel any pressure from me, i realize that this is a "for fun" hobby project, but i am very grateful that it is there for use in my own :). I am currently working on a branch when i added pre-commit and did formatting and so on. So i will move these changes afterwards into something you can easily merge here. I found another thing that was stopping my program from working but i think that was just my mistake. Changing an entry in a list wasnt actually adding to its previous values and so the await next never finished. I have now added a helper variable for that but encoutnered another issue. Will let you know when i understand what is happening. |
Got a fully working version now: https://github.com/JanEricNitschke/TicTacToe/actions/runs/11386283921/job/31678124278#step:5:21 Will swap this to your PyPI hosted one once it has everything in that i need. |
I wanted to run this example from the readme:
and first got an error that "click" is an invalid event. I had a look at the code and it looks like the correct one is "mouseclick".
But even with that i get an error
The text was updated successfully, but these errors were encountered: