Closed petert100 closed 7 years ago
This error occurs if the w1therm
kernel module still knows the sensor which was once attached and with that there is still a file present in /sys/bus/w1/devices
for that sensor but this file is not ready to be read - which is actually the expected behavior since the sensor is detached. So good so far.
In your case it might be enough to just except
that exception and ignore it.
If you do not want to ignore this exception you could try to unload the kernel modules with modprobe -r w1-therm w1-gpio
. And run your program again.
That is kind of what I suspected.
What should I use to ignore the error and where should I put it. ?
thanks.
Just a normal try/except
block would do it. Something like:
try:
print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature()))
except w1thermsensor.core.SensorNotReadyError:
print("Sensor %s is not ready to read")
I close this issue since it's not really one. But feel free to comment further - I'll help.
Thanks for the advice.
here is what I got with the try/except as above
Sensor 000005302180 has temperature 21.00
Traceback (most recent call last):
File "test_many.py", line 25, in
What am I missing? peter
On Mon, Dec 5, 2016 at 2:19 PM, Timo Furrer notifications@github.com wrote:
Just a normal try/except block would do it. Something like:
try: print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature()))except w1thermsensor.core.SensorNotReadyError: print("Sensor %s is not ready to read")
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timofurrer/w1thermsensor/issues/28#issuecomment-264980530, or mute the thread https://github.com/notifications/unsubscribe-auth/ADDPs6lvXvLkboE5uxrPJGBW3kUhhfRVks5rFH_xgaJpZM4LEogh .
-- Peter Carman
307.690.1881 cell 307.733.2389 land line
You didn't import the w1thermsensor
module - You did from w1thermsensor import W1ThermSensor
at the top which only imports the W1ThermSensor
class from the w1thermsensor
package.
Replace it with from w1thermsensor import W1ThermSensor, SensorNotReadyError
and change the except
line to: except SensorNotReadyError:
.
These are some really basic python things, so I suggest you to go through some tutorials to learn those. You'll see - it won't be hard at all. :beers:
Timo, Thank you very much. Those things make sense. M usual Python goto guy ( my son) is en route via the Alaska Highway to Anchorage and is out of touch. so I really appreciate your taking time to help me.
thanks again. Peter
On Mon, Dec 5, 2016 at 10:47 PM, Timo Furrer notifications@github.com wrote:
You didn't import the w1thermsensor module - You did from w1thermsensor import W1ThermSensor at the top which only imports the W1ThermSensor class from the w1thermsensor package.
Replace it with from w1thermsensor import W1ThermSensor, SensorNotReadyError and change the except line to: except SensorNotReadyError:.
These are some really basic python things, so I suggest you to go through some tutorials to learn those. You'll see - it won't be hard at all. 🍻
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timofurrer/w1thermsensor/issues/28#issuecomment-265066585, or mute the thread https://github.com/notifications/unsubscribe-auth/ADDPs2slhLOpaRJyxqWpRgyhDpv3DOuoks5rFPb_gaJpZM4LEogh .
-- Peter Carman
307.690.1881 cell 307.733.2389 land line
Hello Timo I have another question I hope you can help me with. Is there a way(method?) to get the temperature from one known sensor by using the sensor-id? Thanks Peter Sent from my iPhone
On Dec 5, 2016, at 2:20 PM, Timo Furrer notifications@github.com wrote:
I close this issue since it's not really one. But feel free to comment further - I'll help.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi,
Checkout the README here: https://github.com/timofurrer/w1thermsensor#basic-usage-with-one-sensor-explicit
Hey,
I've used this package before and really loved how easy it was to use. I am having issues downloading the package this time. When I try to install it on Rasbian using sudo apt-get install python3-w1thermsensor I get the error: "unable to locate package python3-w1thermsensor" I am using a raspberry pi with rasbian.
As I recall, for me it turned out to have to do with the location of Python. I was , still am, a newbie and had several versions of it in distinct locations.
After resolving that the package has worked very well for years!..... Peter
On Mon, Jun 17, 2019 at 10:22 PM natanbenchimol notifications@github.com wrote:
Hey,
I've used this package before and really loved how easy it was to use. I am having issues downloading the package this time. When I try to install it on Rasbian using sudo apt-get install python3-w1thermsensor I get the error: "unable to locate package python3-w1thermsensor" I am using a raspberry pi with rasbian.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/timofurrer/w1thermsensor/issues/28?email_source=notifications&email_token=AAYM7MYJZLK37FUS74SJ2LLP3BPILA5CNFSM4CYSRAQ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODX5EGSA#issuecomment-502940488, or mute the thread https://github.com/notifications/unsubscribe-auth/AAYM7M5KGKOIC55D2VJ6CN3P3BPILANCNFSM4CYSRAQQ .
-- Peter Carman
307.690.1881 cell
@natanbenchimol you've already opened an issue for your problem #55 , let's keep this one clean :)
Thanks @petert100 and @natanbenchimol 🎉
Hello, Great library. I have used it successfully for groups of sensors. Something I have noticed and been unable to resolve:
the above works fine and if I run the program with 3 sensors I get a line for each.
If I then stop the program and remove a sensor and run it again it returns this message : "w1thermsensor.core.SensorNotReadyError: Sensor is not yet ready to read temperature"
What do I need to do to clear the old list of sensors and start over. ?
thanks