•3 months ago
published a Post
How do I make the run button call a function when the script is done running?The repl here shows how the green run button in replit fails to call the exitcallback function which prints "Goodbye". However, when running the file using bash, using python3 main.py the exitcallback function is correctly called. You can try it by using runshell() in the console. Also, no, I can't use the runshell() function in place of the main() function, the repl will just fail to run properly. Is there any way to configure the run button so that the exit_callback function is called when the script exits? Or is this a bug I should report?
hankertrix @Highwayman I tinkered with the args and it seems that I can't remove any of the args without the repl process crashing. However, removing all the code related to the interpreter seems to have fixed the issue. I'm guessing it's because of using replit's prybar interface that causes Python to not register any exit handlers, since running it using a normal bash shell seems to work fine. I'm guessing most non-nix repls will use the prybar interface by default unless you configure the run button otherwise in the `.replit` file. Thank you so much for your help! I think this should be reported as a bug for prybar.2 months ago
Highwayman @hankertrix I'm glad to be of assistance :P There is a [feedback form](http://replit.com/support) for replit when you get bugs - thats probably the best place to post it. I've contacted them before I'm pretty sure and they're pretty responsive. :)2 months ago
hankertrix @Highwayman Thanks for the link! I'll send them a bug report in a bit.2 months ago