Skip to content
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

Importing JuliaCall interferes with Ctrl + C behavior in Python console #223

Closed
Wainberg opened this issue Sep 17, 2022 · 8 comments
Closed

Comments

@Wainberg
Copy link

Normally in the Python console, if you've typed a line but haven't run it yet, pressing Ctrl + C discards what you've typed, displays KeyboardInterrupt without a stack trace, and starts a new line.

After importing JuliaCall, this behavior changes. Pressing Ctrl + C on its own appears to do nothing - you can still type on the current line. But when you press Enter, you get a KeyboardInterrupt with a stack trace. Everything you've typed between Ctrl + C and Enter may get executed - or it may not.

For example, normally if you type "fo", then press Ctrl + C, then type "o = 1", then press Enter, it discards the "fo" and assigns "o = 1":

>>> fo
KeyboardInterrupt
>>> o = 1
>>> o
1

After importing JuliaCall, it still assigns o = 1, but looks like this:

>>> import juliacall
>>> foo = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyboardInterrupt
>>> o
1

But if o was already defined, the assignment fails:

>>> import juliacall
>>> o = 0
>>> foo = 1
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
KeyboardInterrupt
>>> o
0
@cjdoris
Copy link
Collaborator

cjdoris commented Sep 17, 2022

What version of JuliaCall are you on? I recently changed the signal handling for precisely this reason.

@Wainberg
Copy link
Author

I'm using the latest version, 0.9.6. My Python is 3.10.6 and Julia is 1.8.0.

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 17, 2022

Ok thanks. I'll take a look sometime - signal handling is tricky.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

This issue has been marked as stale because it has been open for 30 days with no activity. If the issue is still relevant then please leave a comment, or else it will be closed in 7 days.

@github-actions github-actions bot added the stale Issues about to be auto-closed label Sep 8, 2023
@github-actions
Copy link
Contributor

This issue has been closed because it has been stale for 7 days. If it is still
relevant, please re-open it.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2023
@Wainberg
Copy link
Author

Still worth a fix :)

@cjdoris
Copy link
Collaborator

cjdoris commented Sep 16, 2023

Is it still an issue? It appears to work fine in Julia 0.9.14 on Windows.

(You can make it not fine again by launching Python like python -X juliacall-handle-signals=yes.)

@Wainberg
Copy link
Author

Ah cool, did you fix it since last year? I haven't checked.

@cjdoris cjdoris removed the stale Issues about to be auto-closed label Sep 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants