Widget: could not load
I need some help with my widget. My widget reads a file and pass the content to an object.
I don’t know why but my widget keeps showing a message saying that it could not load the widget ( in Portuguese) and I need to tap it so that pythonista refreshes the widget and then it shows the data loaded from the file. I mean, I lock the phone and unlock it after 5 seconds and I get this error.
I have the optimization code which does not create a new view as it is in the examples. I copied the code from the launcher widget example.
The launcher example does not have this problem.
def main(): widget_name = __file__ + str(os.stat(__file__).st_mtime) v = appex.get_widget_view() # Optimization: Don't create a new view if the widget already shows the :launcher. if v is None or v.name != widget_name: shelve_file = shelve.open('data') dia = shelve_file['dia'] #print('=====keys====') #print ('keys',dia.keys()) feriados = holidays.Portugal() v = EmentaView(dia) v.name = widget_name appex.set_widget_view(v)
I get the same error while loading my widget (sometimes). It has to do with the amount of memory allocated, you can try and remove some of the other widgets in your notification bar but I have noticed only a very slight difference.