0

Trouble after CircuitPython install
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Trouble after CircuitPython install

by griffisp on Sun Apr 11, 2021 5:59 pm

Hello,

I am having some trouble with my pyportal. I've searched and found someone had the same issue back in 2020 on GitHub and the issue was closed out. I've updated the boot loader and have downloaded and reloaded CircuitPython a couple of times. I keep getting the same error below.

code.py output:
Set background to /pyportal_startup.bmp
Traceback (most recent call last):
File "code.py", line 23, in <module>
File "adafruit_pyportal.py", line 214, in __init__
File "adafruit_pyportal.py", line 207, in __init__
File "adafruit_pyportal.py", line 386, in set_background
AttributeError: 'Display' object has no attribute 'refresh_soon'

Like many I'm new to these boards and MicroPython in general. I thought I could just try and edit the .py files but I can't seem to find them. I just see .mpy files.

Has anyone seen this issue? What am I doing wrong? Any idea where I can look to try and fix the issue?

Thanks for any help

Cheers,
Paul

griffisp
 
Posts: 3
Joined: Sun Apr 11, 2021 5:51 pm

Re: Trouble after CircuitPython install

by dastels on Sun Apr 11, 2021 6:37 pm

It looks like you have outdated libraries. Upgrade everything to the latest. Delete everything in CIRCUITPY/lib and empty trash before copying over new libraries.

Dave

dastels
 
Posts: 6442
Joined: Tue Oct 20, 2015 3:22 pm

Re: Trouble after CircuitPython install

by griffisp on Sun Apr 11, 2021 8:17 pm

Thank you very much for the suggestion. I did what you said.

On the good hand, I'm no longer getting that error. On the other hand I'm getting a different error... lol.

code.py output:
Traceback (most recent call last):
File "code.py", line 23, in <module>
File "adafruit_pyportal/__init__.py", line 152, in __init__
File "adafruit_pyportal/network.py", line 90, in __init__
File "adafruit_pyportal/wifi.py", line 77, in __init__
AttributeError: 'NoneType' object has no attribute 'is_connected'

Code done running.

I sort of understood what the first error was talking about. This error, no idea. Any thoughts?

Thanks again for any assistance.

Cheers,
Paul

griffisp
 
Posts: 3
Joined: Sun Apr 11, 2021 5:51 pm

Re: Trouble after CircuitPython install

by tannewt on Sun Apr 11, 2021 8:44 pm

I think a fix is in the works. See viewtopic.php?f=60&t=177959

tannewt
 
Posts: 2428
Joined: Thu Oct 06, 2016 8:48 pm

Re: Trouble after CircuitPython install

by griffisp on Sun Apr 11, 2021 9:26 pm

Thanks very much for the link! It'll be nice when that gets fixed.

I'll try using an earlier version of that file as suggested in that thread.

Cheers,
Paul

griffisp
 
Posts: 3
Joined: Sun Apr 11, 2021 5:51 pm

Re: Trouble after CircuitPython install

by aq7 on Mon Apr 12, 2021 12:48 am

Paul,

In 'BUG in pyportal/wifi.mpy', topic 177959, working code failed after upgrade.
A prior version of 'lib/adafruit_pyportal/wifi.mpy' got the code working.

Version dates were refined until the exact date of failure was found.
Dates before and after were reported to make it easy for another to find error.

Look at the last file listed in:

File "adafruit_pyportal/__init__.py", line 152, in __init__
File "adafruit_pyportal/network.py", line 90, in __init__
File "adafruit_pyportal/wifi.py", line 77, in __init__
AttributeError: 'NoneType' object has no attribute 'is_connected'

Drilling into Adafruit Circuit Python Library code:

github.com/adafruit <- start here

In the mid page search bar, 'Find a repository...', enter:

adafruit_pyportal

3 results found, select 'Adafruit_CircuitPython_PyPortal'

Now were looking at the PyPortal driver software. (Also Pynt & Titano)

Open folder adafruit_pyportal, which includes:

__init__.py
graphics.py
network.py
peripherals.py
wifi.py

Open wifi.py

Click on History, near upper right, and see:

Commits on April 11, 2021, 'fix testing esp.is_connected in init'

Commits on April 7, 2021, 'Assign requests if we have already connected'

Select 'Assign requests if we have already connected':

77 + if esp.is_connected:
78 + self.requests = requests

These two lines were added on April 7, and are exactly where the code failed:

File "adafruit_pyportal/wifi.py", line 77, in __init__

Now look at 'fix testing esp.is_connected in init':

77 - if esp.is_connected:
77 + if self.esp.is_connected:

Line 77 was modified to correct bug.

You can download the file wifi.py onto your board into folder:

CIRCUITPY/lib/adafruit_pyportal

You do not need to delete wifi.mpy as wifi.py will take precedence:

docs.micropython.org/en/latest/reference/mpyfiles.html

As it is now a .py file, you can edit it.

Compiling .py files into .mpy save precious space on tiny file systems.

Hope this is helpful to you and others who come across this post.

Cheers!

aq7
 
Posts: 6
Joined: Tue Dec 31, 2019 5:52 pm

Please be positive and constructive with your questions and comments.