expectations of context - multiple processes? #2986
jimthouston
started this conversation in
General
Replies: 1 comment
-
|
@jimthouston In case you're running NiceGUI with |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I did a quick gui to send configuration strings to an xyphro usbgpib adapter.
See: https://github.com/xyphro/UsbGpib
This is a USB adapter to the GPIB bus that was/is used by vintage test equipment.
I found that I could not count on leaving the connection to the device open. I got it to work by opening and closing the device each time I needed to access it.
The initial symptom was a stack trace and a EBUSY error. Here are the interesting bits:
I sprinkled in a few print(os.getpid()) calls and found that query that failed was being called from a different process. I was also surprised that there were more calls accessing the hardware than I would have expected.
I suspect that failure is that the new process is reopening the device which is still open in the original process and returns the EBUSY.
I'm not including code because I don't expect you to have the usbgpib hardware. I may experiment to see if the same problem happens with something simple like a serial port.
It has me curious how this works. I wish there was an overview of the nicegui source. I would settle for a pointer to the code that triggers the spawn call above.
Beta Was this translation helpful? Give feedback.
All reactions