You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a very strange use case for this library such that I need two instances accessing the same PWM at the same time. I am aware this is not very typical or recommended. Because one PWM instance can close the file for another PWM instance using the same PWM and thus the same file, if we lose reference to one PWM instance and thus close the file, the other PWM instance will fail as well.
To combat this and to make sure that the other PWM instance can keep going even if one stops and closes the file, we can detect for a FileNotFoundError or PWMError and restart the PWM instance for the one that is intended to keep going. However, I am unsure why this first script does not work for that, but the second script does. The behavior of the first script is that it will keep throwing an error (either FileNotFoundError or PWMError) if another PWM instance stops, closing the file. It never recovers from this. However, the second script will throw the error once and then self-recover, which is intended. I am curious as to why the first script works, and the second script does not.
To reproduce this, start one of each script below and have them fun simultaneously. If you stop the first one first via a KeyboardInterrupt, the second one will throw an error and keep going. This is good. However, if you stop the second one first, the first one will continuously throw an error and does not recover.
I have a very strange use case for this library such that I need two instances accessing the same PWM at the same time. I am aware this is not very typical or recommended. Because one PWM instance can close the file for another PWM instance using the same PWM and thus the same file, if we lose reference to one PWM instance and thus close the file, the other PWM instance will fail as well.
To combat this and to make sure that the other PWM instance can keep going even if one stops and closes the file, we can detect for a
FileNotFoundError
orPWMError
and restart the PWM instance for the one that is intended to keep going. However, I am unsure why this first script does not work for that, but the second script does. The behavior of the first script is that it will keep throwing an error (eitherFileNotFoundError
orPWMError
) if another PWM instance stops, closing the file. It never recovers from this. However, the second script will throw the error once and then self-recover, which is intended. I am curious as to why the first script works, and the second script does not.To reproduce this, start one of each script below and have them fun simultaneously. If you stop the first one first via a
KeyboardInterrupt
, the second one will throw an error and keep going. This is good. However, if you stop the second one first, the first one will continuously throw an error and does not recover.Script that does not work:
Script that works:
The text was updated successfully, but these errors were encountered: