kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.94k stars 492 forks source link

Error 500 when clicking on Camera after starting a timelaps #1246

Closed Stus2 closed 1 year ago

Stus2 commented 1 year ago

Describe the problem/bug Hello, I'm using Mycodo since july and now wanted to start a timelaps of my greenhouse. Since this i can't get to more -> camera and get no image of the camera. every try i get internal server error 500. i think its a overflow error because of my choosen timerange of 99999 seconds but i have no idea how i can resolve this error.

Versions: Version: 8.14.2 Database: 07c7c8ebc195 Model: Raspberry Pi 4 Model B Rev 1.1

Release: Distributor ID: Raspbian Description: Raspbian GNU/Linux 11 (bullseye) Release: 11 Codename: bullseye

Firmware: b''

Error (Full Traceback):

Traceback (most recent call last): File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 2077, in wsgi_app response = self.full_dispatch_request() File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1525, in full_dispatch_request rv = self.handle_user_exception(e) File "/var/mycodo-root/env/lib/python3.9/site-packages/flask_restx/api.py", line 672, in error_router return original_handler(e) File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1523, in full_dispatch_request rv = self.dispatch_request() File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/app.py", line 1509, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(*req.view_args) File "/var/mycodo-root/env/lib/python3.9/site-packages/flask_login/utils.py", line 277, in decorated_view return current_app.ensure_sync(func)(args, **kwargs) File "/home/stu/Mycodo/mycodo/mycodo_flask/routes_page.py", line 300, in page_camera return render_template('pages/camera.html', File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/templating.py", line 148, in render_template return _render( File "/var/mycodo-root/env/lib/python3.9/site-packages/flask/templating.py", line 128, in _render rv = template.render(context) File "/var/mycodo-root/env/lib/python3.9/site-packages/jinja2/environment.py", line 1301, in render self.environment.handle_exception() File "/var/mycodo-root/env/lib/python3.9/site-packages/jinja2/environment.py", line 936, in handle_exception raise rewrite_traceback_stack(source=source) File "/home/stu/Mycodo/mycodo/mycodo_flask/templates/pages/camera.html", line 3, in top-level template code {% set helppage = ["https://kizniche.github.io/Mycodo/Camera/", ('Cameras')] %} File "/home/stu/Mycodo/mycodo/mycodo_flask/templates/layout.html", line 383, in top-level template code {%- block body %}{% endblock -%} File "/home/stu/Mycodo/mycodo/mycodo_flask/templates/pages/camera.html", line 331, in block 'body'
End time: {{epoch_to_time_string(each_camera.timelapse_end_time)}} File "/home/stu/Mycodo/mycodo/mycodo_flask/routes_page.py", line 110, in epoch_to_time_string return datetime.datetime.fromtimestamp(epoch).strftime( OverflowError: timestamp out of range for platform time_t

kizniche commented 1 year ago

32- or 64-bit OS?

i think its a overflow error because of my choosen timerange of 99999 seconds

I'm not sure what you mean, since that is less than 2 days, which is not far in the future at all.

Stus2 commented 1 year ago

Hello, thanks for your fast response. It's a 64-bit OS. Perhaps it was 999999 or 9999999 seconds but this was the only thing i've done. i have searched for a possibiltiy to re-install picamera in hope to delete all configured cams and settings but this doesn't worked. In mycodo log i also found this message: ERROR - mycodo.daemon - Camera 3: Timelapse too far from scheduled time, not capturing

kizniche commented 1 year ago

There was no check to stop someone from inputting any number, so you could have put in a number so large that it's causing the error. I've added the check (yet to be committed) and error-handling for too large values, but in order to use the latest code, you'll need to upgrade to master.

Stus2 commented 1 year ago

Hello again, the update has resolved my problem. Thank you very much

kizniche commented 1 year ago

This issue has been mentioned on Radical DIY Forum. There might be relevant details there:

https://forum.radicaldiy.com/t/mycodo-v8-15-0-release/1362/1