Dehlasoul
Posts: 13
Joined: Tue Sep 05, 2017 7:37 pm

HTTP erro 500 Internal Server problem

Tue Feb 13, 2018 9:30 pm

Ive been going through the code like mad and i still cant find my traceback error, seems that it happens randomly but i know this cant be the case. Maybe i set up my timepassed update interval to seconds when it should be minutes? any suggestions?

Code: Select all

def _mainloop(self):
        while True:
            if error_occurred:
                piface.digital_write(7, int(self.led_toggle_state))
                self.led_toggle_state = not self.led_toggle_state
            if self._update_time_passed >= DATABASE_UPDATE_INTERVAL * 60:
                self.updateDatabase()
                self.writeDatabase()
                self._update_time_passed = 0
            self._update_time_passed += 1
            time.sleep(1)
thats my main look for the update, at the top of my script DATABASE_UPDATE_INTERVAL is marked as 60

so 60 * 60 = 3600 s = 1 Hour

is it possible the self._update_time_passed += 1 is causing the raspberry pi to eventually break and cause the error 500? or should i be looking elsewhere in the script?

Dehlasoul
Posts: 13
Joined: Tue Sep 05, 2017 7:37 pm

Re: HTTP erro 500 Internal Server problem

Tue Feb 13, 2018 10:27 pm

Also, there is a .sh file that i think initializes the .py script , not too sure if this is so these are the contents of said file

Code: Select all

#!/bin/sh

until /home/pi/usb-scanner/usb_scanner.py; do
    date_time=$(date +"%Y-%m-%d %H:%M:%S")
    echo "$date_time\t[Script]\tScript crashed with exit code $?. respawning...\n" | tee /dev/tty >> errors.log
    sleep 1
done

when i tamper with the script and break it sometimes it gives me that "Script crashed with exit code $?. respawning" message , but i can still start the script with

$ sudo python3 usc-scanner.py

Dehlasoul
Posts: 13
Joined: Tue Sep 05, 2017 7:37 pm

Re: HTTP erro 500 Internal Server problem

Wed Feb 14, 2018 7:26 am

I figured it out!!!

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 45 guests