Questions tagged [keyboardinterrupt]

280 questions
0
votes
1 answer

Keyboard Interrup not caught while using sniff function

I am trying to empty the list whenever there is a keyboard interrupt but this doesn't work. Below is my code. while 1: try: n=0 while n<10: pkt=sniff(prn=lambda x:x.sprintf("{Ether : %ether.src% -->…
Abhinav
  • 992
  • 2
  • 11
  • 26
0
votes
1 answer

IDT done in C is not working

I am not being able to get IDT working because my Interrupt routines are not getting called, especially the keyboard related one when i press a key on keyboard. I am passing the IDT table's special 48 bit pointer's address. I am doing it like…
-1
votes
2 answers

How to test a statement for KeyboardInterrupt in PyTest?

Suppose I have a function in my main file like this: # main.py import time def little_sleep(num): time.sleep(float(f'0.{i}')) def wait(): i = 0 while True: try: little_sleep(i) except KeyboardInterrupt: …
-1
votes
1 answer

how to return to executing loop after handling KeyboardInterrupt in python

I have a code that looks like this: some_list = [] try: while True: ... code that uses the list ... except KeyboardInterrupt: ... code that modifies the list ... after handling this exception, how do I return to executing this loop…
Krzysiek127
  • 29
  • 1
  • 2
-1
votes
2 answers

Windows: How does Jupyter throw a keyboard interrupt?

I know how to interrupt the kernel (such as by tapping I twice or by interrupting the kernel on the web interface). However, I built a C-extension for Python (I'm using Windows) that handles CTRL-C events in my C++ code (a toy example): static int…
user1691278
  • 1,751
  • 1
  • 15
  • 20
-1
votes
1 answer

Breaking a loop whilst in GPIO

I am using a while loop to power an LED at regular intervals. I want to run the loop as normal, but have it break and clean up when a key is pressed. import RPi.GPIO as GPIO import…
-1
votes
1 answer

How to use a variable declared in C within inline assembly

I am trying to figure out how to use the variable ret within the inline assembly code below, but I keep getting this error: undefined reference to 'ret. char getkey(void){ int ret; asm( "movq $0, %RAX\n\t" "INT $0X16\n\t" "movq %RAX, ret" ); return…
-2
votes
2 answers

How do you prevent interruptions in a C++ function?

I'm running a long computation in Linux, and every now and then I save partial results. I'd like to prevent interruptions in the function that saves partial results: for example, if a user presses CTRL-C, I want the function to finish and then the…
-2
votes
1 answer

Python keeps giving keyboardInterrupt when I try to end a program that isn't working, and split function isn't working properly

I'm trying to make a python program that will translate to a custom language from an input that is given. I had it working with a gender system, for example the man is de mno while the woman is di felio. I then moved on to making a system where with…
qwerteee
  • 197
  • 9
-2
votes
1 answer

Unable to quit from python script using CTRL+C in Win10

With the following code I'm unable to quit using CTRL+C after running it. I also tried to catch KeyboardInterrupt from different code positions without success. I'm using Windows 10 x64 and Python 3.7.6. async def handle_req(self, reader:…
Antonio Santoro
  • 827
  • 1
  • 11
  • 29
1 2 3
18
19