Debugging Losant Notebooks

#1

At its very core, Losant Notebooks are Juypter Notebooks that you upload to Losant, and we will execute it in our environment next to your IoT data. If you haven’t yet, you can check out the announcement to learn more.

Since you are essentially writing Python code, when writing a notebook, it could be hard to debug and narrow down the problem. Losant is optimized to make sure your notebook gets the inputs it needs to process, and grab the outputs you have defined to integrate into the rest of your application.

I created this notebook to do just that:

  1. It checks to make sure the proper environment variables are set.
  2. It lists out all the inputs in the INPUT_DIR directory. This will allow you to verify that all the inputs are in the right place.
  3. It generates some random data, makes a chart, and saves it to the OUTPUT_DIR directory. This will allow you to verify that a notebook can generate and save output files properly. ( To test this within Losant, make sure you add “chart.png” as an Output File, or it won’t show up in the Execution Log).

Here is the full Notebook code:

If after using this Notebook, you’re still having issues, there may be something wrong will your logic in the Python code. If that’s the case, check out these resources for further help: https://docs.losant.com/notebooks/notebook-file/resources/

If you tell us about what you’re working on, or share it in a Show Losant post, there will be a Losant t-shirt in store for you and a special place in my heart :slight_smile: