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 'USB' #14

Open
awesomer opened this issue Jul 8, 2018 · 2 comments
Open

AttributeError: 'module' object has no attribute 'USB' #14

awesomer opened this issue Jul 8, 2018 · 2 comments

Comments

@awesomer
Copy link

awesomer commented Jul 8, 2018

$ python alphasign_example.py
Traceback (most recent call last):
File "alphasign_example.py", line 37, in
main()
File "alphasign_example.py", line 6, in main
sign = alphasign.USB(alphasign.devices.USB_BETABRITE_PRISM)
AttributeError: 'module' object has no attribute 'USB'

$ python -V
Python 2.7.13
$ which python
/usr/local/bin/python

Platform is OSX Sierra 10.12.6, I'm using python 2.7 from homebrew. Betabrite Prism USB-only version connected via USB. I've installed alphasign, libusb, pyusb and pyserial via pip. I have also installed libusb via "brew install libusb".

The alphasign_example is your example code from readthedocs, copy and pasted.

Thanks for this full featured looking module, any assistance getting it working in my env is greatly appreciated.

Edit -- Device shows up to OSX as follows

USB-BULK Device:
Product ID: 0x1234
Vendor ID: 0x8765
Version: 0.01
Serial Number: 123456
Speed: Up to 12 Mb/sec
Manufacturer: ADAPTIVE
Location ID: 0x14100000 / 14
Current Available (mA): 500
Current Required (mA): 100
Extra Operating Current (mA): 0

which matches the constant from devices.py

  • :const:USB_BETABRITE_PRISM = (0x8765, 0x1234)

Edit 2 :
I look in /usr/local/lib/python2.7/site-packages/alphasign/interfaces/local.py and do not see a USB interface? grep -R USB in the base of the package does not find any results either.

Edit 3 :
Turns out homebrew + pip installs an ancient version of alphasign, 0.9, even though PyPi has 1.0.

I installed via

python setup.py install

from github head and my problem is resolved. Sorry for the noise, but hopefully it will be useful google fodder for future users.

@braveulysses
Copy link

It looks like PyPI has download files for 0.9 but not for 1.0, which is why pip always installs alphasign 0.9.

I was able to install the latest version from this GitHub repo using this pipenv command. I assume the pip command is similar: pipenv install -e git+https://github.com/msparks/alphasign.git#egg=alphasign

@wmartin2
Copy link

I get the same error message as the original poster for this issue:

AttributeError: module 'alphasign' has no attribute 'USB'

I am using alphasign 1.0 using python3:

pip list | grep alphasign

Package Version


alphasign 1.0

from importlib.metadata import version
version('alphasign')
'1.0'

The serial port is:

sudo setserial -g /dev/ttyUSB[01]
/dev/ttyUSB0, UART: unknown, Port: 0x0000, IRQ: 0

What is the method for specifying the serial port for alphasign 1.0?

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