One of the first experiences with Kivy-Python encounters this situation.
The call of
self.fullscreen_image.reload()
of the inialized class in the constructor:
__init__ self.fullscreen_image = AsyncImage(source='http://example.com/1.jpg', nocache=True, allow_stretch=True, size_hint=(1, 0.9)),
where the "1.jpg"
image does not exist and nocache=True
(!), gives a remove_from_cache
(!) error:
File ".venv\Lib\site-packages\kivy\uix\image.py", line 418, in reload
self.remove_from_cache()
File ".venv\Lib\site-packages\kivy\uix\image.py", line 528, in remove_from_cache
super().remove_from_cache()
File ".venv\Lib\site-packages\kivy\uix\image.py", line 429, in remove_from_cache
self.*coreimage.remove_from_cache()
File ".venv\Lib\site-packages\kivy\core\image_init*.py", line 582, in remove_from_cache
pat = type(f)(u'%s|%d|%d')
^^^^^^^^^^^^^^^^^^^^
TypeError: NoneType takes no arguments
Have tried:
try:
self.fullscreen_image.reload()
except Exception as e:
print("Reload error!")
but once AsyncImage is called with non-existing 1.jpg, kivy constantly tries to remove this non-existing image from the cache before the reload()
call and all subsequent calls of self.fullscreen_image.reload()
go to the exception even if "1.jpg"
already exists on the target.
The goal is to display "http://example.com/1.jpg"
when it appears on example.com.
Alex is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.