[Microbit-Python] List of error codes and their meanings

David Booth david.f.booth at googlemail.com
Fri Dec 23 10:09:17 EST 2016


Hi Damien

I have a related question regarding run time errors in micro Python.

I have three micro:bits. The first I call Rx because it basically receives
x axis acceleration data in string form, via the radio from the other two
micro:bits Tx1 and Tx2.  Rx poles Tx1 then Tx2 with 100 ms gaps. Nicholas
Tollervey showed me how to avoid the Type None error when converting the
string to an integer in RX and I now have three simple script which enable
Rx to drive pins P0 (from Tx1) and P8 (from Tx2) with a PWM signal.

However after running perfectly well for anything from 10 seconds to a
minute Rx freezes. On the very few occasions an error message has scrolled
it appears to be saying that "received is not a string" and possibly there
is a value error.  However on 98% of occasions Rx is frozen to the extent
it cannot report the error. Since spurious errors do not worry me, provided
Rx continues with the polling loop, is it possible to suppress catching run
time errors and if it is possible is it likely that the While loop would
continue?

Sometimes pressing reset restarts the system but sometimes I have to remove
the battery.

Thank you  and a Happy Christmas
David Booth
ps will you be at BETT?


On 20 December 2016 at 23:31, Damien George <damien.p.george at gmail.com>
wrote:

> There are many exceptions and they can occur for many reasons.  Almost
> all are based on CPython and the exceptions form a hierarchy.  Eg,
> indexing a list with an out-of-bounds index will raise IndexError,
> which derives from LookupError, which derives from Exception, which
> derives from BaseException.
>
> For a list of implemented exceptions in MicroPython see
> https://github.com/bbcmicrobit/micropython/blob/
> master/source/py/objexcept.c#L192-L280
>
> On 21 December 2016 at 08:35, David Whale <david at thinkingbinaries.com>
> wrote:
> > Is there anything in the docs that lists all the errors (exceptions) that
> > can occur in MicroPython and what they mean?
> >
> > The closest I found was this:
> >
> > https://github.com/bbcmicrobit/micropython/blob/
> a20fbe82c919cea9519ce5a1140103f518b51caa/inc/py/qstrdefs.h
> >
> >
> > Thanks
> >
> > David
> >
> > microbit.org-ticket: 460
> >
> >
> >
> > _______________________________________________
> > Microbit mailing list
> > Microbit at python.org
> > https://mail.python.org/mailman/listinfo/microbit
> >
> _______________________________________________
> Microbit mailing list
> Microbit at python.org
> https://mail.python.org/mailman/listinfo/microbit
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/microbit/attachments/20161223/e0adcba0/attachment.html>


More information about the Microbit mailing list