boot.py Vs main.py
-
I'm trying to figure out a way to determine if my gpy is running boot.py or main.py. None of the online suggestions for identifying the current process like
import __main__ print(__main__.__file__) AttributeError: 'module' object has no attribute '__file__'or
import sys this_function_name = sys._getframe( ).f_code.co_name AttributeError: 'module' object has no attribute '_getframe'or
import sys print (sys.argv[0]) IndexError: list index out of rangework. Surely there must be a way in pycoms flavour of micropython to do this?
-
if you do normal stuff, both files shall run. First boot than main.
You can set a local variable, a method or so, to print out for logging or to use in an if statement.
Do you still hunt your syntax error bug? If yes, try to precompile your stuff. You may use too much memory too early, so that the on device compiler fails with strange messages. Frozen files will be better for testing. Even the *.mpy files need RAM and may fail when the memory is heavy fragmented on an early stage. But testing such issues with precompiled files is quite easy compared with the frozen workflow
If you mix 4mb an lower device, develop on a smaller device and test the newer one quite often.
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login