shpi / pi3d_ui_application

3 stars 6 forks source link

http ical links trigger errors #7

Open errrrata opened 4 years ago

errrrata commented 4 years ago

When adding an https ical link in configuration file (using a google calendar ical link), there are a number of errors:

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import shpi.main
  File "/home/pi/zero_main_application/shpi/main.py", line 360, in <module>
    textchange, activity, slide_offset)
  File "/home/pi/zero_main_application/shpi/slides/ical2.py", line 108, in inloop
    init()
  File "/home/pi/zero_main_application/shpi/slides/ical2.py", line 28, in init
    icalfile = requests.get(config.ICALLINK).text #TODO httprequest stuff needed here?
NameError: name 'requests' is not defined

since 'requests' is not imported. If importing 'requests' in ical2.py this error appears:

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import shpi.main
  File "/home/pi/zero_main_application/shpi/main.py", line 360, in <module>
    textchange, activity, slide_offset)
  File "/home/pi/zero_main_application/shpi/slides/ical2.py", line 109, in inloop
    init()
  File "/home/pi/zero_main_application/shpi/slides/ical2.py", line 32, in init
    gcal = Calendar.from_ical(icalfile.read())
AttributeError: 'str' object has no attribute 'read'

After working around this issue, a new error appears:

Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import shpi.main
  File "/home/pi/zero_main_application/shpi/main.py", line 360, in <module>
    textchange, activity, slide_offset)
  File "/home/pi/zero_main_application/shpi/slides/ical2.py", line 110, in inloop
    init()
  File "/home/pi/zero_main_application/shpi/slides/ical2.py", line 40, in init
    tzinfo=None) - now2, reverse=False)  # order dates soonist to now to farthest
  File "/home/pi/zero_main_application/shpi/slides/ical2.py", line 38, in <lambda>
    tzinfo=None) - now2 > timedelta(0), components)  # filter out past events
TypeError: 'tzinfo' is an invalid keyword argument for replace()