Closed LanXtai closed 1 year ago
I haven't used multiprocessing. However doing a google search, I found this (https://stackoverflow.com/questions/72557549/pyftdi-issue-with-multiprocessing), which sheds a bit more light on the issue. It appears multiprocessing when using arguments causes multiple imports which makes that error display, which probably wouldn't be a problem in most other instances.
Is it possible to use a try/except block to get past the error?
@caternuson do you have any other ideas? Like is it possible to have it automatically catch the error and return the initialized interface instead of it trying to reinitialize the interface?
Unknown. I think short answer here is multiprocessing is not generally supported. It might work to do as you are suggesting, but then other multithread issues might crop up. It'd take work to test and investigate.
Sounds good. I'm going to close this as unsupported.
Hi ! I tried using Adafruit-Blinka with Multiprocessing on Windows 10, Python 3.9, and got an unexpected error. First, here is a working minimal code, without Blinka :
fonction
being in a separate filefonction_file.py
:So far, it works just fine, but I need to go further and use an FT232H with Adafruit-Blinka (the idea is, as a beginning, to blink a LED as a process). But as soon as I change my
fonction_file.py
into(even with only the
import board
line, or only with thefrom digitalio import DigitalInOut, Direction
one), I get the following error :even though I didn't use the packages in my process. However, doing
with
fonction2
being defined as :works just fine ! The difference is around the arguments : where
fonction
(called withtarget=fonction
) has one argument, passed withargs=(nb,)
,fonction2
doesn't need any argument and is called withtarget=fonction2()
. Is there any way to pass arguments to a method in a process while using Adafruit-Blinka ? Thanks !