oracle / graalpython

A Python 3 implementation built on GraalVM
Other
1.17k stars 101 forks source link

AttributeError: module 'signal' has no attribute 'SIGCONT' #396

Closed tkowalcz closed 1 month ago

tkowalcz commented 1 month ago

Hi,

as a Java developer I am really enjoying GraalPython and ability to write most of my code in Java. Thank you for that. However I have encountered issues trying to run textual from www.textualize.io. The os is mac os Sonoma 14.4.1. The errors are related to signals handling:

python3 -m textual

...

...src/main/resources/vfs/venv/lib/python3.10/site-packages/textual/drivers/linux_driver.py:65 in │
│ __init__                                                                                                                          │
│                                                                                                                                   │
│    62 │   │   # have bound to call the relevant action on App) to suspend the                                                     │
│    63 │   │   # application.                                                                                                      │
│    64 │   │   signal.signal(signal.SIGTSTP, self._sigtstp_application)                                                            │
│ ❱  65 │   │   signal.signal(signal.SIGCONT, self._sigcont_application)     

AttributeError: module 'signal' has no attribute 'SIGCONT'

If I comment this line out then I will get similar error with SIGTTOU. Don't know about this one but SIGCONT should be available on MacOS X.

I am using GraalPy 3.10.13 (Oracle GraalVM Native 24.0.0). I tried to build the newest one from source to test master branch but these instructions failed me on:

mx build && mx python
...
mx: unknown command 'python'

Any help or pointers will be appreciated.

msimacek commented 1 month ago

I'll add the signals, not sure why we didn't have them already. I tried textual with my fix and it seemed to work.

mx: unknown command 'python' You need to run the mx commands from graalpython repository directory.

tkowalcz commented 1 month ago

Thank you. Did you run python -m textual? My "fixes" might have broke something there bu what I get is (after a random key press):

image

vs. normally working app when using standard Python.

msimacek commented 1 month ago

Yes, I did get a working app (at least I didn't get the artifacts you did).

But I'm on Linux, so there can be some difference in terminal handling. I don't have a Mac to try it there. Can you try a different terminal emulator? Also try running with TERM=dumb (it will be graphically broken because it's dumb, but it should still react to input).

tkowalcz commented 1 month ago

Indeed, the remaining issue was the terminal. So with signal issues patched it works, even on mac os. Thanks!

Do you want me to close the ticket?

msimacek commented 1 month ago

Indeed, the remaining issue was the terminal. So with signal issues patched it works, even on mac os. Thanks!

Can you tell me which terminal worked and which didn't? Just in case somebody else runs into the same problem

Do you want me to close the ticket?

No, a bot will close it when my fix for the signals merges.

tkowalcz commented 1 month ago

The Warp did not work, while iTerm worked. Note that it works under Warp when using regular Python (3.9.6).