Picoware - custom app error message 'Could not load application'

Hi,

A complete newbee to any community ever here! Please be understanding if I’m breaking any house rules.

Having been frustratingly unsuccessful trying to display ‘catfact.ninja’ API json data on the PicoCalc using Webmite (MMBasic and a Pico 2W installed), I thought I’d try a micropython approach using JBlanked’s latest Picoware.

I wrote a simple script that works absolutely fine as intended with Windows Thonny IDE connected to the Pico, but when I try to run the .py file (saved in the SD card’s app directory) using the Picoware Applications Library menu, I get ‘Could not load application’.

I’ve tried reloading the firmware, using a different (Kingston) SD card, using the firmware’s native editor to rewrite & save the script, and running an .mpy file (generated using ‘mpy-cross’), but I unfortunately keep getting get the same error message. Please can anyone point me in the right direction?

Many thanks in advance.

Hey, thanks for checking out Picoware. Could you paste your code here (or a link to it on Github)? More than likely you either don’t have the required lifecycle methods and/or have a testing block still in the code.

Hi, many thanks for getting back to me so quickly, it’s greatly appreciated.

I’ve successfully completed a few raspbian-based python Zero 2W projects e.g. mp3 file player, mp3 radio, photo slideshow, API data, musical tones, clock & timers, scientific calculator etc.(Nothing browser based.) I decided to experiment on how hard I can push a Pico 2W to recreate as many of the capabilities mentioned above as possible (with the advantage of near instant boot-up and longer battery life), so I thought a PicoCalc would make a good starting platform.

As Picoware’s wifi automatically boots up I thought I might just get away with the following code, but it’s now become clear to me thai it isn’t as simple as that (especially with very limited RAM):

import urequests
import time

url = “https://catfact.ninja/fact
response = urequests.get(url)

if response.status_code == 200:
data = response.json()
print(f"Cat Fact: {data[‘fact’]}")
else:
print(“Failed to retrieve data”)

response.close()

1 Like

Ohh I see now! You just need the lifecycle methods. Here’s an example of using HTTP requests:

This guide explains how Apps work:

Libraries are here:

And tutorials are here:

Thanks again, this should keep me going for a while. I’m 63 years old and still bumbling my way up new tech learning curves :wink:

Btw, is mp3 internet radio achievable with Picoware? (I already have a VS1053 codec board standing by if I need it!)

1 Like

It’s achievable on a Pico 2W maybe, but not implemented yet.

It is available on the WebMite MMbasic S/W but is becoming less useful. Most internet radio stations are now using protocols that the VS1053 can’t decode directly. In some cases this is complex wrappers (HLS) that would have to be decoded before passing the stream to the VS1053. Others use a codec which isn’t supported at all by the VS1053 (Opus). Getting anything remotely like global coverage is probably outside the scope of a uP like the RPs