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
Any ideas about how I could work around this? Or ways to rearrange things?
I don't think it'll be possible unless I move the auto-loading of the kernel module to w1thermsensor.core and don't import that in __init__.py - and with that basically making the user to import w1thermsensor manually.
AFAIK there is no way to import something like w1thermsensor.error as module without the w1thermsensor/__init__.py being imported, too ...
As a work around you could disable the auto-loading and just call it yourself:
# set W1THERMSENSOR_NO_KERNEL_MODULE=1 in environment (either before launching your app or in the app)
from w1thermsensor import W1ThermSensor, load_kernel_modules, KernelModuleLoadError
try:
load_kernel_modules()
except KernelModuleLoadError as exc:
...
Or you are basically fine with just catching it as Exception ... but I agree to your point that with that the KernelModuleLoadError is basically useless.
Hi, I was trying to catch the KernelModuleLoadError and handle it.
However, its not possible to import the exception without raising the error.
This seems to be because your
__init__.py
module calls theload_kernel_modules()
method immediately.So its not possible to get a reference to the error without raising it first.
Any ideas about how I could work around this? Or ways to rearrange things?
The text was updated successfully, but these errors were encountered: