Skip to content

Can not invoke program from main.py #109

@rvreugde

Description

@rvreugde

Hello,

I have a very weird issue.

I have developed a tiny program to read and show my weatherstation data.
It works fine, when invoking this program from Thonny on my Presto. It also works fine, when saving this to the presto and start the program from Thonny.

When I start the Presto without connected to Thonny, main.py starts and I see my program in the list.
But, when I want to run it by selecting the icon, it does not run. It gives a black screen for a few seconds and returns back to the main.py.

I have stripped down my program to the bare minimum (connecting to wifi and showing a background). Still, it won't run in stand-alone mode (from main.py).

And now it becomes strange...

I renamed the program to main.py, overwrite the "default" main.py on the Presto and restarted it. Now, my programs works fine.

Is there something I have to do extra, to make it run from main.py, like clearing memory or something else?
BTW, I have other programs, working fine, starting from main.py...

I have checked the main.py. Could it anything have to do with the ramfs? After selecting the program icon, it writes down the program name in /ramfs/launch.txt and resets...

def launch(self):
    with open("/ramfs/launch.txt", "w") as f:
        f.write(self.file)
            
    # Clear the display buffer before launching the next app
    display.set_pen(BLACK)
    display.clear()
    presto.update()

    # Reset!
    machine.reset()

Thanks for your help!

ArVie

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions