Hardcoded version of Python for external scripts #355

Open
opened 2020-10-18 16:35:10 +01:00 by haplm · 4 comments
haplm commented 2020-10-18 16:35:10 +01:00 (Migrated from github.com)

Describe the bug
Python version for external scripts (read DHT temperature, for example) is hardcoded as "python"
cmd = sudo_str + "python " + script + str(sensor) + " " + str(pin)

Since Octoprint is moving towards python3, I have installed Adafruit's libraries under python3, which means I need python3 as interpreter for the scripts.

Yes, I could setup alternatives and set python3 as python, but I'm not sure whether I'm not going to break something. It might be better to either make python executable configurable, or maybe stop calling parts of the plugin (in Python) as scripts?

Unfortunately there are also some parsing issues related to the version change, see #354 (title misleading, it works perfectly fine on RPi 4).

Could you suggest the best way moving forward?

To Reproduce
Steps to reproduce the behavior:

  1. Install Adafruit's DHT libraries under Python3
  2. Configure at least one DHT sensor
  3. Check logs

Additional context
After the changes described in the linked issue (local edits), I can read data from DHT sensors just fine. I can help with some testing, but unfortunately I'm not a Python programer, so I don't dare to fix this for everybody.

**Describe the bug** Python version for external scripts (read DHT temperature, for example) is hardcoded as "python" ```cmd = sudo_str + "python " + script + str(sensor) + " " + str(pin)``` Since Octoprint is moving towards python3, I have installed Adafruit's libraries under python3, which means I need python3 as interpreter for the scripts. Yes, I could setup alternatives and set python3 as python, but I'm not sure whether I'm not going to break something. It might be better to either make python executable configurable, or maybe stop calling parts of the plugin (in Python) as scripts? Unfortunately there are also some parsing issues related to the version change, see #354 (title misleading, it works perfectly fine on RPi 4). Could you suggest the best way moving forward? **To Reproduce** Steps to reproduce the behavior: 1. Install Adafruit's DHT libraries under Python3 2. Configure at least one DHT sensor 3. Check logs **Additional context** After the changes described in the linked issue (local edits), I can read data from DHT sensors just fine. I can help with some testing, but unfortunately I'm not a Python programer, so I don't dare to fix this for everybody.
vitormhenrique commented 2020-10-20 16:26:27 +01:00 (Migrated from github.com)

I'm also moving away from python2, all sensors and libraries will be installed on the same environment of the octoprint on the future version...

A lot of people have issues installing and configuring libraries, so my plan is to include everything on the setup... and for external scripts I'll create a box input what python environment / file to use.....

You can follow python 3 thread here:

https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/302

I'm also moving away from python2, all sensors and libraries will be installed on the same environment of the octoprint on the future version... A lot of people have issues installing and configuring libraries, so my plan is to include everything on the setup... and for external scripts I'll create a box input what python environment / file to use..... You can follow python 3 thread here: https://github.com/vitormhenrique/OctoPrint-Enclosure/issues/302
domhardt commented 2020-12-03 21:33:09 +00:00 (Migrated from github.com)

It seems that I'm having the same problem. While I can successfully query the sensor values from the command line, the OctoPrint Plugin only shows 0°C and 0% RH for my AM2302. Please find the screenshots and log attached.

Bildschirmfoto 2020-12-03 um 11 46 59 Bildschirmfoto 2020-12-03 um 11 48 50 Bildschirmfoto 2020-12-03 um 11 46 10

octoprint.log

It seems that I'm having the same problem. While I can successfully query the sensor values from the command line, the OctoPrint Plugin only shows 0°C and 0% RH for my AM2302. Please find the screenshots and log attached. <img width="570" alt="Bildschirmfoto 2020-12-03 um 11 46 59" src="https://user-images.githubusercontent.com/1955290/101090729-6386d480-35b7-11eb-8572-b75bcf5b766f.png"> <img width="708" alt="Bildschirmfoto 2020-12-03 um 11 48 50" src="https://user-images.githubusercontent.com/1955290/101090745-6a154c00-35b7-11eb-80d1-5e5a40ac8b3d.png"> <img width="994" alt="Bildschirmfoto 2020-12-03 um 11 46 10" src="https://user-images.githubusercontent.com/1955290/101090760-6e416980-35b7-11eb-92a9-bdabd8c24284.png"> [octoprint.log](https://github.com/vitormhenrique/OctoPrint-Enclosure/files/5639028/octoprint.log)
vitormhenrique commented 2020-12-03 23:43:52 +00:00 (Migrated from github.com)

@domhardt you you are using python 3 this plugin is not yet compatible with it! I'm working on a major refactor but it takes time...

@domhardt you you are using python 3 this plugin is not yet compatible with it! I'm working on a major refactor but it takes time...
domhardt commented 2020-12-04 10:11:32 +00:00 (Migrated from github.com)

@domhardt you you are using python 3 this plugin is not yet compatible with it! I'm working on a major refactor but it takes time...

Yes, I'm using the latest OctoPi version and Python 3. Keep on the good work!

> @domhardt you you are using python 3 this plugin is not yet compatible with it! I'm working on a major refactor but it takes time... Yes, I'm using the latest OctoPi version and Python 3. Keep on the good work!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Gandalf/OctoPrint-Enclosure#355