SparkFun Forums 

Where electronics enthusiasts find answers.

Questions &/or issues related to products in the Qwiic category should be posted in this forum. To learn more about Qwiic, consider checking out our pillar page on the Qwiic system.
User avatar
By gpetty
#205806
The sparkfun-qwiic package for python appears to be fundamentally broken on my RaspberryPi3 (raspbian version Jesse)

Specifically, I successfully installed the module using
Code: Select all
sudo pip3 install sparkfun-qwiic
but when I run the following simple program
Code: Select all
import qwiic
# attempt to get list of current devices (fails!)
results = qwiic.list_devices()
print(results)
I get the error traceback
Traceback (most recent call last):
File "./qwiic.py", line 3, in <module>
import qwiic
File "/home/pi/Programs/qwiic.py", line 9, in <module>
results = qwiic.list_devices()
AttributeError: 'module' object has no attribute 'list_devices'
This error first came up under Python 2.7, and I thought upgrading to Python 3.4 might fix it, but no such luck.

I also tried dir(qwiic), and it confirms that there are apparently no callable functions/methods of any kind associated with the module. I couldn't find any mention of this problem by anyone else, so there must be something peculiar about my setup. I haven't had a similar problem with any other Python module.
User avatar
By gpetty
#205816
So the problem described above goes away if I copy the source code file at https://raw.githubusercontent.com/spark ... _init__.py to a file qwiic.py in my working directory. This suggests that there's something wrong with the installation process rather than the code itself. Since I don't know what happens under the hood when a module is installed, I'm not sure how to track down the problem.
#206187
Have you had any luck? I just got my Qwiic kit and I'm stuck at the part trying to install Qwiic following their guide.
Code: Select all
sudo pip install sparkfun_qwiic
sudo: pip: command not found
I did sudo pip3 install and that seemed to work, but still can't get Qwiic to work. I continue to work through all the broken and missing modules until I think I get it to work and run the test code:
Code: Select all
import qwiic
results = qwiic.list_devices()
print(results)
and get
Code: Select all
[(61, 'Qwiic Micro OLED', 'QwiicMicroOled'), (91, 'Qwiic CCS811', 'QwiicCcs811'), (96, 'Qwiic Proximity Sensor', 'QwiicProximity'), (119, 'Qwiic BME280', 'QwiicBme280')]
but when it comes time to run the actual program I'm met with so many "has no attribute" errors
Code: Select all
Traceback (most recent call last):
  File "qwiic_kit_for_pi_demo.py", line 64, in <module>
    oled.setFontType(1) 
AttributeError: 'QwiicMicroOled' object has no attribute 'setFontType'
comment out that section and..
Code: Select all
Traceback (most recent call last):
  File "temp.py", line 93, in <module>
    proximity = prox.getProximity()
AttributeError: 'QwiicProximity' object has no attribute 'getProximity'
User avatar
By TS-Mark
#206210
Hi everyone,

DamagedDolphin, I believe you posted this issue on the tutorial here and a member of our tutorials team responded with some information about the issue and an update for the GitHub repo that should fix it.

gpetty, try running that install again and let me know if you're still having issues. As far as I am aware, it should be fixed for Python 3.7.