Closed nrontsis closed 1 year ago
Weird. I could only reproduce this on the first try.
The only place I see try...catch
through the downloading call stack is https://github.com/johnnychen94/jill.py/blob/cfc14a6a700172833487bdc1ef2204b14d4cb88a/jill/download.py#L50-L69, but it's limited to network exceptions.
wget.download
directly calls urllib.request.urlretrieve
. Maybe it's something there since it's a legacy interface?
@johnnychen94 I think it's a jnumpy's issue, I could reproduce in my compute.
In [1]: import basic # success
In [2]: import wget
In [3]: wget.download("https://wrongURL")
# <- Ctrl-C does not work here
My envrionment:
os: win10
python: 3.10
I assume you're saying it's a wget issue?
In [1]: import wget
In [2]: wget.download("https://hi")
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
KeyboardInterrupt
This Python package isn't maintained since 2015, so maybe this issue is a good reason to drop wget-python in jill.
Other task also fail to use KeyboardInterrupt too, so maybe something of jnumpy breaks the signal handling
Register a signal handler may solve this problem, but I could not find where jnumpy breaks this yet, and not sure if other signal handler works fine. @thautwarm could you have a look?
import time
import signal
default_sigint_handler = signal.getsignal(signal.SIGINT)
print(default_sigint_handler) # <built-in function default_int_handler>
import jnumpy as jnp
jnp.init_jl()
print(signal.getsignal(signal.SIGINT)) # still <built-in function default_int_handler> ???
signal.signal(signal.SIGINT, default_sigint_handler) # if we don't call this, the Ctrl-C would not work below
# Ctrl-C works here
for i in range(10):
print(i)
time.sleep(1)
ps: it's weird. the code above works fine in my archlinux system, but fails in my win10 system :(
We need to disable the signal handle of julia in python mode:
SessionCtx.JULIA_START_OPTIONS = ["--handle-signals=no", jl_opts_proj, *jl_opts]
This solves the problem.
As described in the title, KeyboardInterrupt stops working after importing the
basic
example of this repo.How to reproduce:
Using the
Dockerfile
below run:and then
Dockerfile: