0

I am working on a IoT project. I am using flask and apache2. When I to run the program, I get errors with it trying to use the modules. I tried the following Reinstalling the module to other versions, Adding PYTHONPATH, and expanding the python code search directory. The latter seemed to yield the best results. The former would do nothing (adding the PYTHONPATH) or adding the directory in the wsgi file would cause it to error in function calls in the module or other modules (like flask.py).

I am now getting issues in module call. It works separately when not in apache, but i get the following error in my apache2 log

[wsgi:error] [pid 22380:tid 3048207360] [client 192.168.1.10:62280]   File "/usr/local/lib/python3.7/dist-packages/pigpio_dht/dht11.py", line 24, in __init__
[wsgi:error] [pid 22380:tid 3048207360] [client 192.168.1.10:62280]     super(DHT11, self).__init__(gpio, pi=pi, timeout_secs=timeout_secs, use_internal_pullup=True, max_read_rate_secs=1, datum_byte_count=1)
[wsgi:error] [pid 22380:tid 3048207360] [client 192.168.1.10:62280] TypeError: super() argument 1 must beust be type, not classobj

Here is my python code

import sys
sys.path.append('/usr/local/lib/python3.7/dist-packages/')
sys.path.append('/usr/lib/python3/dist-packages/')
from pigpio_dht import DHT11
from flask import Flask, redirect, url_for, render_template, request, jsonify
import RPi.GPIO as io
import time
import os

os.system("sudo pigpiod")
#Raspberry Pi Variables
#Temp Sensor
temp_gpio = 4
sensor = DHT11(temp_gpio)
#Light/Relay Sensor
io.setmode(io.BCM)
light_gpio = 14
io.setup(light_gpio, io.OUT)

My wsgi file

#!/usr/bin/env python3

activate_this = '/var/www/webApp/venv/bin/activate_this.py'
with open(activate_this) as file_:
        exec(file_.read(), dict(__file__=activate_this))

import sys
sys.path.insert(0, '/var/www/webApp')

from app import app as application

It errors at the sensor = DHT11(temp_gpio) call. I have other parts of the code, but I don't think theyre relevant to the issue. If I comment out the sensor=DHT11(temp_gpio) line, the code and web page successfully loads

zealotben
  • 13
  • 2

0 Answers0