Voting resources, early voting, and poll worker information - VOTE. ... Adafruit is open and shipping.

PyPortal.fetch() fail 6.0x-rc "Cannot access text after gett
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

PyPortal.fetch() fail 6.0x-rc "Cannot access text after gett

by haroldf on Sat Oct 17, 2020 7:45 pm

I'm getting a parse-type error after I installed adafruit-circuitpython-pyportal_titano-en_US-6.0.0-rc.0.uf2 on pyportal titano.
I used the "cutefuzz" project as a simple example. (The same errors occurred with nasa picture and tides projects, as well as with my local php json feed.)
Code: Select all | TOGGLE FULL SIZE
import board
from adafruit_pyportal import PyPortal


pyportal = PyPortal(url=DATA_SOURCE,
                    image_resize=(320, 240),
                    image_position=(50, 50))

for i in range(3):
    response = None
        response = pyportal.fetch()
        print("Response is", response)
    except RuntimeError as e:
        print("attempt ",i+1,"Some error occured, retrying! -", e)

The "Response is" statement never executes.
I inserted some print stmts into which gives some context to where the error occurs:
Set background to /cute_background.bmp
No SD card found: no SD card
Retrieving data...Socket missing recv_into. Using more memory to be compatible
-hrf bytearray(b'HTTP/1.1')
-hrf bytearray(b'OK')
hrf bytearray(b'Sat, 17 Oct 2020 22:36:22 GMT')
hrf bytearray(b'application/json')
hrf bytearray(b'80')
hrf bytearray(b'keep-alive')
hrf bytearray(b'__cfduid=dde5199502d7eace49466b9726790c26a1602974181; expires=Mon, 16-Nov-20 22:36:21 GMT; path=/;; HttpOnly; SameSite=Lax')
hrf bytearray(b'DYNAMIC')
hrf bytearray(b'05da4e01a90000eaf49e8a7000000001')
hrf bytearray(b'{"endpoints":[{"url":"https:\\/\\/\\/report?lkg-colo=12&lkg-time=1602974182"}],"group":"cf-nel","max_age":604800}')
hrf bytearray(b'{"report_to":"cf-nel","max_age":604800}')
hrf bytearray(b'cloudflare')
hrf bytearray(b'5e3d7f7bc811eaf4-LAX')
Reply is OK!
attempt 0 Some error occured, retrying! - Cannot access text after getting content or json

I tried this with 4 different JSON feeds -- different head info, but same error msg.

Posts: 4
Joined: Sun Oct 11, 2020 12:20 pm

Re: PyPortal.fetch() fail 6.0x-rc "Cannot access text after

by tannewt on Mon Oct 19, 2020 6:02 pm

Please update the PyPortal library you've been using. It's been updated to fix this issue. (Requests was update to lower it's memory use at the cost of not allowing text access and then json access.)

Posts: 1837
Joined: Thu Oct 06, 2016 8:48 pm

Please be positive and constructive with your questions and comments.