You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wrote a Rust module battlesnake_gym and loaded it into the virtual environment. I ran the script below in IPython and hit Control + C after about 5 seconds, but the script was not interrupted. In fact, IPython now ignores Control + C completely. More information later.
fromtimeimportsleepimportbattlesnake_gym# This is a Rust module built with PyO3/Maturin.for_inrange(100):
sleep(0.1)
However, if I run this script in python the default REPL, it gets interrupted by Control + C normally. Therefore, this should have something to do with IPython, not just PyO3/Maturin.
Reproduction
I was trying to provide a minimum reproducible example, but failed with the bare PyO3 examples. Below are the rough steps to reproduce with my codebase, which would be nicer for someone who already have Rust and Rye to try out (sorry about the heavy dependencies).
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh ## Install Rust.# curl -sSf https://rye-up.com/get | bash ## Install Rye.## Clone codebase.
git clone https://github.com/SichangHe/STATS402_course_project.git
cd STATS402_course_project
git submodule update --init
# Build Rust module.cd battlesnake_train
rye sync
## Run IPython in the virtual environment.# Remember to add the appropriate extension to the following command.. .venv/bin/activate
ipython
## Below are my outputs. I hit control + C ~5sec after `In [1]`.## Notice that there are no `KeyboardInterrupt` exceptions.## Actually, it wasn't interrupted.# Python 3.11.8 (main, Feb 25 2024, 04:18:18) [Clang 17.0.6 ]# Type 'copyright', 'credits' or 'license' for more information# IPython 8.23.0 -- An enhanced Interactive Python. Type '?' for help.## In [1]: from time import sleep# ...: import battlesnake_gym# ...:# ...: for _ in range(100):# ...: sleep(0.1)# ...:# ^C# In [2]:
Control C's search keys: control + c, ctrl c, ctrl + c, controlc, ctrlc.
The text was updated successfully, but these errors were encountered:
I wrote a Rust module
battlesnake_gym
and loaded it into the virtual environment. I ran the script below in IPython and hit Control + C after about 5 seconds, but the script was not interrupted. In fact, IPython now ignores Control + C completely. More information later.However, if I run this script in
python
the default REPL, it gets interrupted by Control + C normally. Therefore, this should have something to do with IPython, not just PyO3/Maturin.Reproduction
I was trying to provide a minimum reproducible example, but failed with the bare PyO3 examples. Below are the rough steps to reproduce with my codebase, which would be nicer for someone who already have Rust and Rye to try out (sorry about the heavy dependencies).
Control C's search keys: control + c, ctrl c, ctrl + c, control c, ctrl c.
The text was updated successfully, but these errors were encountered: