Adafruit_io/client.py modules platform etc not found

Moderators: adafruit_support_bill, adafruit

Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.
Locked
User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Adafruit_io/client.py modules platform etc not found

Post by paulskpt »

Trying to run a script that imports the module Adafruit_io.

In my script is the line: ```from Adafruit_IO import Client, Feed, Data, RequestError```.

Code: Select all

In /lib/adafruit_io/client.py are the module imports:
import platform
import pkg_resources
import re
from urllib.parse import urlparse
from urllib.parse import parse_qs
The re modules is built-in CPY.
CPY reports import errors for the modules:
- platform;
- pkg_resources;
- urllib.

I don't have these modules installed on my MAGTAG. They results in 'ImportError's.
I tried to find these modules on Github/Adafruit.com but no success.

Anyone that can give my advice to resolve this problem?

User avatar
rooppoorali
 
Posts: 98
Joined: Sat Jul 16, 2022 12:04 pm

Re: Adafruit_io/client.py modules platform etc not found

Post by rooppoorali »

Hello, have you tried the suggestion mentioned here for pkg_resources ?

https://stackoverflow.com/questions/744 ... -resources

User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Re: Adafruit_io/client.py modules platform etc not found

Post by paulskpt »

Thank you. The discussion in the link is about modules for - let's say - installations of Python on a Raspberry Pi or other linux system.
I am using it on a microcontroller with CircuitPython v8 installed. I need modules from some Adafruit_CircuitPython_<module> repo.

User avatar
adafruit_support_carter
 
Posts: 29056
Joined: Tue Nov 29, 2016 2:45 pm

Re: Adafruit_io/client.py modules platform etc not found

Post by adafruit_support_carter »

This looks like a general issue with using CircuitPython libraries. See here for info on working with library modules:
https://learn.adafruit.com/welcome-to-c ... -libraries

Are you following a guide? If so, please link to it.

User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Re: Adafruit_io/client.py modules platform etc not found

Post by paulskpt »

Thank you. No, I am not following a guide. I am wanting to use parts of examples that I think are usefull to what I have in mind to acomplish.
I have 'the world' on Adafruit CircuitPython libraries installed on one of the drives of my desktop PC on which I am doing the developments for my projects.
The latest version of the CPY firmware is flashed onto the device. Sure, I copy the necessary libraries onto the 'CIRCUITPY' drive of the device.
Regularly I update the important libraries/bundles. With the Windows Explorer of MS Windows 11 I did a search for 'platform', 'pkg_resources' and 'urllib'. Results: negative.

I just saw that urllib is a library that is created for "normal" Python. (see https://docs.python.org/3/library/urllib.html

User avatar
danhalbert
 
Posts: 4613
Joined: Tue Aug 08, 2017 12:37 pm

Re: Adafruit_io/client.py modules platform etc not found

Post by danhalbert »

Those modules are not available in CircuitPython. adafruit_io (from https://github.com/adafruit/Adafruit_IO_Python) is a library for use with CPython, not with CircuitPython. If you'd like to use AdafruitIO with CircuitPython, see the examples in various guides, such as https://learn.adafruit.com/iot-pyportal ... cuitpython

User avatar
paulskpt
 
Posts: 30
Joined: Sat Oct 03, 2015 7:30 pm

Re: Adafruit_io/client.py modules platform etc not found

Post by paulskpt »

Thank you Dan for the clarification. Sometimes I loose track with all these different 'families'.

Case closed.

Locked
Forum rules
If you're posting code, please make sure your code does not include your Adafruit IO Active Key or WiFi network credentials.

Return to “Internet of Things: Adafruit IO and Wippersnapper”