10 Replies Latest reply on Sep 28, 2017 11:54 AM by jmeredith

    Err executing working Python script from within SAM component on Raspbian

    gstadter

      I am very much extremely green when it comes to both Raspberry Pis and Linux (till now I've lived within my SQL/PowerShell/C# world).

      I have an Adafruit DHT temp sensor attached to a Pi 3 B, Python 2.7.9.

      When I place the following code into a .py file within /tmp and call it while in a putty session, I am returned a line containing the data I am trying to pull, but when I put the same script in a Linux SAM component, I get:

      "Testing on target node failed with 'Down' status ('Down' might be different if script exits with a different exit code).

       

      #!/usr/bin/python

      import sys

      import Adafruit_DHT

      humidity, temperature = Adafruit_DHT.read_retry(11, 4)

      print 'Temp: {0:0.1f} C  Humidity: {1:0.1f} %'.format(temperature, humidity)

       

      notes:

      Script Argument is just: python ${SCRIPT}

      Script Working Directory: /tmp

      I am using the pi account, credentials added in SolarWinds, of course.

      additionally, I've discovered that it is bombing on the "humidity, temp....." line, not on the "import Adafruit_DHT" line

       

      Why would the exact same code execute perfectly from the /tmp dir, logged in as "pi", yet fail when inside of Linux monitor component using same dir and credentials?

       

      -Lost