Pythonista-Issues
Pythonista-Issues copied to clipboard
Widget -- loaded fail
Hi!
If use module requests in python scripts running on iPad mini 2 via widget -- work good. But if running this script on iPhone 6 via widget -- error that tell "loaded fail". iOS version on devices - lastest 10.3.2.
I just got the same. It went away when I ran the script in Pythonista, then "re-deployed" it by selecting again the 'Use in "Today"' option in the top right corner.
I did it several times. Experienced to find out if you remove the requests module, then the script on the widget is launched.
Might be an issue with the widget's limited memory available. An iPad mini 2 might allow more memory use for the widget than an iPhone 6 does. Just speculation, though.
@Mas73r can you please attach sample code, which demonstrates this issue?
@zrzka, example:
#!python3
import appex, ui, json
import requests
url = "https://balance.sipnet.ru/?format=2&sipuid=12345678&password=PASSWD»
data = json.loads(requests.get(url).text)
label = ui.Label(font=('Menlo', 24), alignment=ui.ALIGN_CENTER)
label.text = 'SIPNET: ' + data['balance'] + " " + data['currency']
appex.set_widget_view(label)
For access to SIPNET accout, you may free sign up on https://www.sipnet.net
To be honest, I'm not sure where to go with the widget. I'm seriously considering to remove this feature entirely because it just has a lot of problems that I'm seemingly unable to solve 🙁. Fortunately, I'm not really "advertising" it anywhere (except for release notes and docs), so I woudn't feel too bad about it, though it obviously wouldn't be ideal.
One problem is that widgets in general just have an extremely limited RAM budget, but I'm not even sure that's the entire reason for the problems. I have three main test devices – an iPad Pro (latest generation, iOS 11), an iPad Air 2 (iOS 10), and an iPhone SE (iOS 11). Surprisingly, the widget works fine on the older two of those devices, but I cannot get even the most basic UI examples to work on the iPad Pro. It always gets killed after a few seconds, and shows the dreaded "Unable to load" message, presumably because of memory pressure. But I have no idea why it works on the older devices, and I have recently spent an entire day trying various things... So I can't just say "you need a recent device" because it doesn't really seem connected to that. It could be that some devices need more RAM to display the widget for whatever reason, but I don't know why, and much less how I could influence that.
Anyway, I don't think I'll have a good solution for this soon, I just wanted to say that the issue is probably not "user error" or something like that.
is that limited RAM budget problem improved in iOS 13?It would be great if we can do more things in Today Widget.Thanks.