AttributeError: 'module' object has no attribute 'YKUSH' after yk = pykush.YKUSH()
skxo opened this issue · 4 comments
Hello,
I try to use ykush inside a python script.
I can use normally using the shell command (for example sudo ykushcmd -d 2).
Then, I use the pykush.py found inside the folder and it work fine
sudo ~/yepkit/pykush/pykush/pykush.py -l
ting YKUSH family devices
found a YKUSH release 2 device with serial number YKC5112
system device path 0002:007e:00, vendor id 0x04d8, product id 0xf2f7
the device is running a v1.0 firmware and has 3 downstream ports
downstream running power states, port 1 to 3: UP, UP, UP
But my problem is when I try to use inside a python script or via the python console:
sudo python
Python 2.7.12 (default, Dec 4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import pykush
yk = pykush.YKUSH()
Traceback (most recent call last):
File "", line 1, in
AttributeError: 'module' object has no attribute 'YKUSH'
quit()
I do not simply know why!
Thanks in advance for your debug skills.
sk
I had the same issue and solved it replacing
import pykush
with
from pykush import pykush
I realize that pip package pykush is totally different module (https://pypi.org/project/pykush/) which points to https://github.com/alvarop/pykush . Unfortunately this package is not in pip so adding lib as setup.py dependency is a bit tricky.. Could Ykush guys public this in pip even it's still in alpa state ? Would be easier to use as dependency..
Still an issue. If no fix/change is intended it would be great if at least the sample code could be updated according to the solution of @Brainmuck.
In my case, the issue is resolved with the following command. Refer-- https://pypi.org/project/yepkit-pykush/
pip install yepkit-pykush