Skip to content

Fixed cyclic import #32

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 26, 2021
Merged

Fixed cyclic import #32

merged 1 commit into from
Mar 26, 2021

Conversation

evaherrada
Copy link
Collaborator

No description provided.

@evaherrada evaherrada requested a review from kattni March 23, 2021 19:16
@ladyada
Copy link
Member

ladyada commented Mar 23, 2021

did ya test this with hardware?

@evaherrada
Copy link
Collaborator Author

evaherrada commented Mar 23, 2021

I didn't. I can if you want me to.

@ladyada
Copy link
Member

ladyada commented Mar 23, 2021

yah plz

@evaherrada
Copy link
Collaborator Author

@ladyada I don't actually have the hardware to test. I can order it if you'd like me to or we could just have someone that does have the hardware already test it.

@ladyada
Copy link
Member

ladyada commented Mar 23, 2021

@brentru can u test when you're around next plz

@ladyada ladyada requested review from brentru and removed request for kattni March 23, 2021 19:20
@anecdata
Copy link
Member

anecdata commented Mar 23, 2021

I think there might be an issue with adafruit_bus_device, or something. Even before trying the PR, I couldn't get the released version to work with current libraries on 6.2.0-beta.4 or 6.1.0. Initially tried a Feather RP2040, then backed up to Feather M4 with the above. I tried older and older Requests, then finally backed up to 5.3.1 and old libraries from that time (20200714), on a Feather M4, and that worked.

Old stuff:

Adafruit CircuitPython 5.3.1 on 2020-07-13; Adafruit Feather M4 Express with samd51j19
>>> # CS on board.A5
>>> # library bundle 20200714
>>> import wiznet5k_simpletest.py
Wiznet5k WebClient Test
Chip Version: w5500
MAC Address: ['0xde', '0xad', '0xbe', '0xef', '0xfe', '0xed']
My IP address is: 192.168.6.223
IP lookup adafruit.com: 104.20.39.240
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
This is a test of Adafruit WiFi!
If you can read this, its working :)

----------------------------------------

Fetching json from http://api.coindesk.com/v1/bpi/currentprice/USD.json
----------------------------------------
{'time': {'updated': 'Mar 23, 2021 20:32:00 UTC', 'updatedISO': '2021-03-23T20:32:00+00:00', 'updateduk': 'Mar 23, 2021 at 20:32 GMT'}, 'disclaimer': 'This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org', 'bpi': {'USD': {'code': 'USD', 'description': 'United States Dollar', 'rate_float': 54869.0, 'rate': '54,868.9933'}}}
----------------------------------------
Done!

Newer stuff:

Adafruit CircuitPython 6.1.0 on 2021-01-21; Adafruit Feather M4 Express with samd51j19
>>> # CS on board.A5
>>> # library bundle 20210320
>>> import wiznet5k_simpletest.py
Wiznet5k WebClient Test
Chip Version: w5500
MAC Address: ['0xde', '0xad', '0xbe', '0xef', '0xfe', '0xed']
My IP address is: 192.168.6.223
IP lookup adafruit.com: 104.20.38.240
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "wiznet5k_simpletest.py", line 38, in <module>
  File "adafruit_requests.py", line 681, in get
  File "adafruit_requests.py", line 572, in request
  File "adafruit_wiznet5k/adafruit_wiznet5k_socket.py", line 286, in recv
  File "adafruit_wiznet5k/adafruit_wiznet5k_socket.py", line 391, in available
  File "adafruit_wiznet5k/adafruit_wiznet5k.py", line 475, in socket_available
  File "adafruit_wiznet5k/adafruit_wiznet5k.py", line 788, in _get_rx_rcv_size
  File "adafruit_wiznet5k/adafruit_wiznet5k.py", line 828, in _read_snrx_rsr
  File "adafruit_wiznet5k/adafruit_wiznet5k.py", line 876, in _read_socket
  File "adafruit_wiznet5k/adafruit_wiznet5k.py", line 428, in read
  File "adafruit_bus_device/spi_device.py", line 73, in __enter__
KeyboardInterrupt: 

(Probably coincidence, but I see similar behavior with forever-waits on certain reads with ESP32SPI sockets on Feather RP2040.)

Addendum:
CircuitPython 6.0.0 through CircuitPython 6.2.0-beta.4 work with 20200714 libraries, but CircuitPython 6.2.0-beta.4 does not work with 20210324 libraries, so it appears to be a library issue.

I let it go this time (no keyboard interrupt) and it eventually got a socket exception:

Wiznet5k WebClient Test
Chip Version: w5500
MAC Address: ['0xde', '0xad', '0xbe', '0xef', '0xfe', '0xed']
My IP address is: 192.168.6.223
IP lookup adafruit.com: 104.20.39.240
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "wiznet5k_simpletest.py", line 38, in <module>
  File "adafruit_requests.py", line 681, in get
  File "adafruit_requests.py", line 586, in request
OutOfRetries: Repeated socket failures

Likely a Requests issue or how newer requests interacts with the wiznet5k socket: The only libraries needed for the simpletest code are: requests and wiznet5k (native adafruit_bus_device), and 6.2.0-beta.4 works with 20210324 wiznet5k + 20200714 requests

From a little print-debugging... Requests appears to be failing because recv from the wiznet socket repeatedly times out before detecting the magic "H" in HTTP/1.1 200 OK.

Copy link
Member

@brentru brentru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following @anecdata - I noted that the latest version of the adafruit_requests library has an issue with this library. However, that isn't related to this specific PR.

To isolate this PR from the issue with requests - I tested this pull request using an older library bundle but with the latest circuitpython version (Adafruit CircuitPython 6.2.0-beta.4 on 2021-03-18; Adafruit Feather M4 Express with samd51j19):

Wiznet5k WebClient Test
Chip Version: w5500
MAC Address: ['0xde', '0xad', '0xbe', '0xef', '0xfe', '0xed']
My IP address is: 192.168.1.175
IP lookup adafruit.com: 104.20.38.240
Fetching text from http://wifitest.adafruit.com/testwifi/index.html
----------------------------------------
This is a test of Adafruit WiFi!
If you can read this, its working :)

----------------------------------------

Fetching json from http://api.coindesk.com/v1/bpi/currentprice/USD.json
----------------------------------------
{'time': {'updated': 'Mar 26, 2021 14:48:00 UTC', 'updatedISO': '2021-03-26T14:48:00+00:00', 'updateduk': 'Mar 26, 2021 at 14:48 GMT'}, 'disclaimer': 'This data was produced from the CoinDesk Bitcoin Price Index (USD). Non-USD currency data converted using hourly conversion rate from openexchangerates.org', 'bpi': {'USD': {'code': 'USD', 'description': 'United States Dollar', 'rate_float': 53330.1, 'rate': '53,330.0883'}}}
----------------------------------------
Done!

Code done running.

This code is OK to merge in, however, @anecdata do you want to open a new pull request within adafruit_requests or on this repo to address the issue with this library and requests?

@brentru
Copy link
Member

brentru commented Mar 26, 2021

@dherrada Was this pull request in reference to a specific issue/forum post?

@evaherrada
Copy link
Collaborator Author

@brentru I don't think so. I'm pretty sure I was just going through the libraries that were failing their pylint checks.

@evaherrada evaherrada deleted the linting branch April 6, 2021 21:19
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 7, 2021
Updating https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground to 4.3.3 from 4.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_CircuitPlayground#104 from kattni/main-fix
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_DHT to 3.6.0 from 3.5.8:
  > Merge pull request adafruit/Adafruit_CircuitPython_DHT#68 from yeyeto2788/master
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_FocalTouch to 1.2.7 from 1.2.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_FocalTouch#20 from adafruit/linting
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_RockBlock to 1.3.3 from 1.3.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_RockBlock#21 from adafruit/linting
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_Wiznet5k to 1.9.3 from 1.9.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Wiznet5k#32 from adafruit/linting
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_AdafruitIO to 5.2.4 from 5.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_AdafruitIO#68 from brentru/validate-feed-keys-used
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_AVRprog to 1.3.7 from 1.3.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_AVRprog#21 from adafruit/linting
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_BitmapSaver to 1.1.6 from 1.1.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_BitmapSaver#14 from kmatch98/patch-2
  > "Increase duplicate code check threshold "
  > Merge pull request adafruit/Adafruit_CircuitPython_BitmapSaver#17 from FoamyGuy/pylintrc

Updating https://github.com/adafruit/Adafruit_CircuitPython_BLE_Radio to 0.3.5 from 0.3.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_BLE_Radio#15 from adafruit/linting
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_BoardTest to 1.2.6 from 1.2.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_BoardTest#15 from adafruit/linting
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_datetime to 1.1.3 from 1.1.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_datetime#8 from adafruit/jepler-integer-total_seconds
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_Display_Text to 2.18.3 from 2.18.2:
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#150 from jposada202020/advanced_example
  > Merge pull request adafruit/Adafruit_CircuitPython_Display_Text#149 from jposada202020/optimizing_getting_font_info

Updating https://github.com/adafruit/Adafruit_CircuitPython_RGBLED to 1.1.5 from 1.1.4:
  > Merge pull request adafruit/Adafruit_CircuitPython_RGBLED#15 from adafruit/dherrada-patch-1
  > "Increase duplicate code check threshold "

Updating https://github.com/adafruit/Adafruit_CircuitPython_RSA to 1.2.4 from 1.2.3:
  > Merge pull request adafruit/Adafruit_CircuitPython_RSA#18 from adafruit/linting
  > "Increase duplicate code check threshold "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants