🎄⛄❄️🎁 It's beginning to look a lot like ADABOX-mas! The next ADABOX from Adafruit ships soon! Get yours now, or give as a gift! 🎄⛄❄️🎁
0

PyPortal thermometer.py won't run
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PyPortal thermometer.py won't run

by loggerman on Wed Jun 12, 2019 7:02 pm

Hi, I am getting weird error messages, like

NameError: name 'T' is not defined, any ideas?

Regards, AB

Image

loggerman
 
Posts: 10
Joined: Wed Jun 12, 2019 6:51 pm

Re: PyPortal thermometer.py won't run

by franklin97355 on Wed Jun 12, 2019 8:49 pm

Not sure, there is no variable named T in the program. Can you give more information?

franklin97355
 
Posts: 21333
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: PyPortal thermometer.py won't run

by arteiot on Wed Jun 12, 2019 9:24 pm

Hi, unfortunately it isn't giving me any further info, like where this error is (or the file).

I have followed all the instructions that were given to try out the IO portal, but no joy. It does run the original code.py file with the quotes. I checked that all the correct files are there.

I did have trouble getting it started on my Ubuntu laptop, but it seems to work ok now if I switch back to the original code.py

Regards, AB
arteiot
 
Posts: 7
Joined: Sat Sep 21, 2013 7:30 pm

Re: PyPortal thermometer.py won't run

by franklin97355 on Thu Jun 13, 2019 1:08 am

According to one of the other techs, this might help. https://learn.adafruit.com/welcome-to-circuitpython/kattni-connecting-to-the-serial-console#kattni-connecting-to-the-serial-console
See the big blue box and apt command needed to remove.

franklin97355
 
Posts: 21333
Joined: Mon Apr 21, 2008 2:33 pm
Location: Lacomb, OR.

Re: PyPortal thermometer.py won't run

by loggerman on Thu Jun 13, 2019 10:46 am

Hi, yes, I tried running Picocom to see if I could use REPL, but that didn't work either. I think I will give up at this point because I was expecting this to be a dead simple experience, but so far it is not. I will try to find another program that will run, but what I was really wanting to do was to test the IO system.

Is there another code example somewhere that might work for testing Adafruit IO, instead of this thermometer code?

Regards, AB

loggerman
 
Posts: 10
Joined: Wed Jun 12, 2019 6:51 pm

Re: PyPortal thermometer.py won't run

by adafruit_support_carter on Thu Jun 13, 2019 12:29 pm

Did you run the command linked above to remove modemmanager?

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: PyPortal thermometer.py won't run

by loggerman on Thu Jun 13, 2019 8:12 pm

Hi, yes, I ran this:

sudo apt purge modemmanager

Then I tried Picocom again (which we normally use to connect to Micropython running on an EsP32) but it still failed.

Then I ran into this article on the web, which describes exactly the same problem I am having:

https://bigl.es/pyportal-corrupt-files/

So I then restored my code.py to the original default 'quotes' code, and it ran fine. I was careful to hit the Eject button in Ubuntu Nautilus, to make sure it was finished writing the file (which I always do, having read the docs).

So, I restored the thermometer.py into the code.py file, thinking it may have been corrupted. This time I got new errors:

pyportal-errors2.jpg
pyportal-errors2.jpg (121.47 KiB) Viewed 169 times


Then I rebooted it and it went back to the same errors as in the first picture. Sheesh.

Is the temperature sensor itself at fault?

Could this be a corrupted library component? Maybe I should start from scratch and reformat the whole thing??

Regards, Adrian

loggerman
 
Posts: 10
Joined: Wed Jun 12, 2019 6:51 pm

Re: PyPortal thermometer.py won't run

by adafruit_support_carter on Thu Jun 13, 2019 9:15 pm

Have you set up a feed named temperature in your Adafruit IO account? The error message is saying it can not locate that feed.

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: PyPortal thermometer.py won't run

by arteiot on Thu Jun 13, 2019 9:23 pm

Hi, no, I never got that far because I could not get the program to run, as per the instructions - I only got as far as setting up a new IO account. This was apparently unnecessary as I have already had an account for purchases for quite a few years.

But thanks for pointing that out as I was wondering if the Pyport might have a defective temperature sensor.

Regards, AB
arteiot
 
Posts: 7
Joined: Sat Sep 21, 2013 7:30 pm

Re: PyPortal thermometer.py won't run

by adafruit_support_carter on Fri Jun 14, 2019 12:50 pm

I think you're OK. Go ahead and setup the AIO feed and keep working through the guide. If you run into other snags, report back here. But for now, the error message you're getting makes sense. Hopefully it's just a matter of a few things like this to get you working.

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: PyPortal thermometer.py won't run

by loggerman on Fri Jun 14, 2019 1:51 pm

Hi, ok, thanks for letting me know. If it turns out to be that I hadn't set up Adafruit IO, then that will be a relief. But it would probably help other users to understand that the program won't run properly until this is done.

I was expecting to see this, with perhaps a subsequent message saying "no sensor found in IO account":

pyportal-no-errors.jpg
pyportal-no-errors.jpg (27.64 KiB) Viewed 144 times


Regards, AB

loggerman
 
Posts: 10
Joined: Wed Jun 12, 2019 6:51 pm

Re: PyPortal thermometer.py won't run

by adafruit_support_carter on Fri Jun 14, 2019 2:11 pm

The feed setup is covered here:
https://learn.adafruit.com/pyportal-sma ... t-io-setup
The guides are generally setup to be worked through serially. So if you skipped that and jumped to the code part:
https://learn.adafruit.com/pyportal-sma ... cuitpython
you'd miss that setup.

Are you thinking maybe some kind of call out on that code page that says "Make sure you've setup the AIO feed?".

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Re: PyPortal thermometer.py won't run

by loggerman on Fri Jun 14, 2019 2:32 pm

yep!

loggerman
 
Posts: 10
Joined: Wed Jun 12, 2019 6:51 pm

Re: PyPortal thermometer.py won't run

by loggerman on Fri Jun 14, 2019 11:46 pm

Hi, ok, so I have created a block and a widget to read the temperature at AIO:

loggerman∕Dashboards∕Pyportal Sensor Test

I just used the default slider configured for zero to 100 re temperature reading.

But I still get the same errors that are seen in the original image I posted.

Shouldn't I have to tell the code which widget to send temperature data to?

I guess it's back to 'read the docs' time ...

LATER THE NEXT DAY ...

I did read the docs again, and I realized that the feed at AIO needs to be specifically named 'temperature'. I changed that, rebooted the Pyportal, and voila, I got the Analog Devices splash screen. Yay!

So it seems you were correct, I should have set up the AIO system properly, before I ran the code in the Pyportal. I still think it should boot with the splash screen and detect that the AIO setup was not done.

After the boot splash screen it then goes blank and won't light up with the temperature display when I wave my hand in front of it, so should it do that by default? It is sending the data to AIO, so at least I know it is working.

I also cannot get the Picocom serial USB interface to work. This is the prompt line in Terminal (Ubuntu 16.04) that we use to get the REPL on our ESP32 boards:

picocom -b 115200 /dev/ttyUSB0

Should it be different?

Tks, AB

loggerman
 
Posts: 10
Joined: Wed Jun 12, 2019 6:51 pm

Re: PyPortal thermometer.py won't run

by adafruit_support_carter on Mon Jun 17, 2019 12:14 pm

Run dmesg after plugging in the PyPortal and check where the /dev entry is actually created. On my Ubuntu system, the PyPortal is setup as a ttyACMx device, so typically shows up at
Code: Select all | TOGGLE FULL SIZE
/dev/ttyACM0

or similar.

adafruit_support_carter
 
Posts: 13589
Joined: Tue Nov 29, 2016 2:45 pm

Please be positive and constructive with your questions and comments.