Timeline for How to implement a callback using PyCall?
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 1, 2025 at 11:15 | comment | added | Tim | The fact that PyCall is not Thread safe is a separate issue. I think it means one can not initiate a Python object in the main Ruby thread and then use it in a Ruby sub-thread. | |
| Dec 1, 2025 at 11:07 | history | edited | Tim | CC BY-SA 4.0 |
specified (what I think is) the issue at hand
|
| Nov 29, 2025 at 4:06 | comment | added | Alex | maybe asynchronous version is just not supported github.com/red-data-tools/… | |
| Nov 28, 2025 at 11:22 | comment | added | Tim |
Thank you for your responses. I tried both lambda's, which don't not work, both offer the following response: .../pycall/pytypeobject_wrapper.rb:24:in `call_object': <class 'TypeError'>: Resource temporarily unavailable (PyCall::PyError). I think whatever is passed to the reader.start_reading() function should be something Python understands. Hence, I think I need a way to transform the found function (or the lambda) from Ruby to Python using PyCall - the same is true for the other two variables (which are optional so I omitted them in my test).
|
|
| Nov 28, 2025 at 3:42 | comment | added | Alex |
if you need a lambda it should be: reader.start_reading(->(tag){ puts tag.epc }, 250, 0) or reader.start_reading(method(:found), 250, 0)
|
|
| Nov 27, 2025 at 11:43 | comment | added | C3roe |
The example there in the docs is reader.start_reading(lambda tag: print(tag.epc)) - have you tried the same thing? reader.start_reading(lambda tag: found(tag), on_time=250, off_time=0)
|
|
| Nov 27, 2025 at 11:32 | history | asked | Tim | CC BY-SA 4.0 |