Skip to content
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

AttributeError: 'module' object has no attribute 'windll' #1

Closed
arp opened this issue Apr 5, 2016 · 9 comments
Closed

AttributeError: 'module' object has no attribute 'windll' #1

arp opened this issue Apr 5, 2016 · 9 comments

Comments

@arp
Copy link

arp commented Apr 5, 2016

I've tried using the package on El Capitan 10.11.4, and it fails during import:

>>> import co2meter as co2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/site-packages/co2meter/__init__.py", line 3, in <module>
    from co2meter import *
  File "/usr/local/lib/python2.7/site-packages/co2meter/co2meter.py", line 6, in <module>
    import hid
  File "/usr/local/lib/python2.7/site-packages/hid/__init__.py", line 24, in <module>
    hidapi = ctypes.windll.LoadLibrary('hidapi.dll')
AttributeError: 'module' object has no attribute 'windll'
@vfilimonov
Copy link
Owner

Hello Artur,

that's quite weird - looks like you've got a Windows version of the library... Did you install hid or hidapi? What does

$ pip list | grep hid

say?

Best
Vladimir

@vandeseer
Copy link

I got the exact same problem as mentioned by @arp above although I followed exactly the steps as described in the README. The outcome of the command you mentioned is the following in my case:

hid (0.1.1)
hidapi (0.7.99.post20)

Any help is very appreciated :)
Thanks!

@vfilimonov
Copy link
Owner

Hi @vandeseer
It looks to me that this is a mere name conflict: both hid and hidapi contain hid python module. And for some reason import hid imports it from hid but not from hidapi which is required for the co2meter.

Could you please quickly check if uninstalling hid (pip uninstall hid in console) solves the issue?

@vandeseer
Copy link

Thank you very much for your answer @vfilimonov ! Currently I do not have the device at hand, but running pip uninstall hid (and afterwards the example code) changed the error message:

File "/Users/.../Library/Python/2.7/lib/python/site-packages/co2meter/co2meter.py", line 102, in hid_open
  self._h.open(self._info['vendor_id'], self._info['product_id'])
File "hid.pyx", line 66, in hid.device.open (hid.c:1802)
IOError: open failed

But my guess is, that this is simply due to the fact that the device isn't plugged in ... I will try it within the next days in order to see whether it is now working correctly – thanks again for your support! :)

@vfilimonov
Copy link
Owner

Great! Please let me know if it helps.

I will then update the readme and make the error output more informative.

@vfilimonov
Copy link
Owner

Ok, I see. It was installed due to wrong setup.py. I'll fix it

@vfilimonov
Copy link
Owner

Done, the updated version is in the pypi already.
@vandeseer please confirm if it works

@vandeseer
Copy link

It does indeed work now @vfilimonov – so thanks again for your work on the project in general and your quick help on this issue in particular! :)

@vfilimonov
Copy link
Owner

you're welcome, @vandeseer
I'm glad that you've found the library to be useful!

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

No branches or pull requests

3 participants