Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Syntax Error

    Scheduled Pinned Locked Moved GPy
    9 Posts 3 Posters 62 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K Offline
      kjm
      last edited by

      Is there anyway to trap a 'syntax error' from boot.py & use it to redirect program execution to main.py?

      robert-hhR 1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @kjm
        last edited by

        @kjm try/except also catches syntax errors.

        K 1 Reply Last reply Reply Quote 0
        • K Offline
          kjm @robert-hh
          last edited by kjm

          @robert-hh I've got everything wrapped in try/except Rob. But every so often the gpy wakes from deepsleep & announces a syntax error at some random line where there wasn't one before. This happens before boot.py actually runs. It's almost like the micropython is compiled rather than interpreted.

          robert-hhR J 2 Replies Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @kjm
            last edited by

            @kjm There are two other scripts which are executed before boot.py. These are _boot.py and _main.py or _main_pybytes,. They are embedded into the flash. With the new pybytes firmware, _main_pybytes.py is pretty large and imports even more core. See https://github.com/pycom/pycom-micropython-sigfox/tree/Dev/esp32/frozen/Pybytes
            But still it should be create an syntax error. SInce it does and the lines are random, I would consider a hardware or power supply related fault.

            1 Reply Last reply Reply Quote 0
            • J Offline
              jcaron @kjm
              last edited by

              @kjm I I think we’ve seen reports of very similar issues in the past. Too lazy to search the forum, but it’s quite likely it was related to a power issue in most cases.

              How is your module powered? There’s usually a pretty big spike in current at boot and not all power supplies can handle that correctly.

              K 1 Reply Last reply Reply Quote 0
              • K Offline
                kjm @jcaron
                last edited by kjm

                @jcaron In my RPi days I had a hook file that started 2 programs on power up, the sensor reading/server communicating central program and a 2nd internet governance program that rebooted the Pi if server comms ceased (usually because the central program froze). Is it possible to do something similar on the gpy?

                J 1 Reply Last reply Reply Quote 0
                • J Offline
                  jcaron @kjm
                  last edited by

                  @kjm said in Syntax Error:

                  @jcaron In my RPi days I had a hook file that started 2 programs on power up, the sensor reading/server communicating central program and a 2nd internet governance program that rebooted the Pi if server comms ceased (usually because the central program froze). Is it possible to do something similar on the gpy?

                  If you mean restart the GPy if things go awry, then that would be the task of the WDT (watchdog timer), but if your issue is that the code that could set up the WDT doesn't even run, then obviously that doesn't meet your needs. You could add that to frozen byte code, though, if that one runs correctly.

                  But, again, how is you GPy powered? Many power supplies are just not adapted to the current spike on boot.

                  K 1 Reply Last reply Reply Quote 0
                  • K Offline
                    kjm @jcaron
                    last edited by

                    @jcaron Fairly sure it's not power supply related. Do you know if there is a micropython command I can use to identify which program is actually running, boot.py or main.py?

                    J 1 Reply Last reply Reply Quote 0
                    • J Offline
                      jcaron @kjm
                      last edited by

                      @kjm have you checked this thread: https://forum.pycom.io/topic/3705/lopy4-exp-board-syntax-error-after-deepsleep

                      Apparently there were changed in a previous version of the firmware (possibly linked to underlying ESP-IDF changes) that supposedly fixed the issue, but there seems to be a difference between FAT and LittleFS.

                      Also you’ll find references to use of wdt_on_boot and try ... except.

                      If none of those work you may want to try other firmware versions to see if that helps, or maybe another GPy to make sure it’s not just the one you have which is faulty.

                      1 Reply Last reply Reply Quote 0

                      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
                      • 1 / 1
                      • First post
                        Last post

                      Pycom on Twitter

                      Pycom