braiden/python-ant-downloader

import usb.core fails with "No module named core"

jzacsh opened this issue · 4 comments

Strangely I get this error:

$ git checkout master
$ git pull origin master
$ ./ant-downloader.py
Traceback (most recent call last):
  File "./ant-downloader.py", line 2, in <module>
    from antd.main import downloader
  File "/home/jzacsh/tmp/src/python-ant-downloader/antd/__init__.py", line 35, in <module>
    import antd.hw as hw
  File "/home/jzacsh/tmp/src/python-ant-downloader/antd/hw.py", line 30, in <module>
    import usb.core
ImportError: No module named core

# _(same when I prefix with `PYTHON= ` to ensure its not an env. issue)_

Seems like its probably my fault (bad env.?), but figured I'd put this issue out, until I'm sure (feel free to close this if you have no thoughts on the matter)....

Some more info (previously, I ran sudo apt-get install python-usb for package version 0.4.3-1):

$ python --version
Python 2.7.3

$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=12.10
DISTRIB_CODENAME=quantal
DISTRIB_DESCRIPTION="Ubuntu 12.10"

$ locate usb | grep py
/usr/lib/pyshared/python2.7/usb.so
# ....

Any thoughts on what might be going on?

Hmm.. seems this would be solved if I re-read your readme.me :)

In case anyone else comes across this and doesn't do python development:

Here are the basic steps I took to solve this (I haven't copy/pasted this myself, so read it first)...

sudo apt-get install python-pip &&
    pyusbdir="$(mktemp -d)" &&
    pushd "$pyusbdir" &&
    git clone https://github.com/walac/pyusb &&
    cd ./pyusb/; git checkout 1.0.0a3 &&
    sudo pip install ./pyusb/ &&
    popd &&
    rm "$pyusbdir" -rfv &&
    unset pyusbdir

Some explanation:
The problem, as braiden points out in his README.md, is that pyusb version 0.4 (which is the default ubuntu debian package) does not work. The above steps just clone the the latest pyusb, checkout a v1 of that code and install it on your system.

I solved the pyusb with this:
pyusbdir="$(mktemp -d)"
pushd "$pyusbdir"
git clone https://github.com/walac/pyusb
cd pyusb/
git checkout 1.0.0b1
sudo python setup.py install
popd
sudo rm "$pyusbdir" -rfv

Running on Ubuntu 12.04 I put the files:
sendto_silhouette.inx
sendto_silhouette.py
silhouette
in the directory ~/.config/inkscape/extensions/

Then I add the user to the group lp. Otherwise inkscape has to start with sudo :-(

stupid non-debian-way the right solution using the system-wide are backporting the pyusb package from unstable..

  • debian, winbuntu winhat default python usb modulo is << 1.0 that has full of bugs

  • soluciton is use backporting or from unstalbe:

  1. revise you have an entry of backport in apt sources list:
    deb deb http://ftp.de.debian.org/debian jessie-backports main contrib non-free
    NOTE can do this as:
    echo "deb http://ftp.de.debian.org/debian jessie-backports main contrib non-free" > /etc/apt/sources.list.d/backports.list
  2. update apt database:
    apt-get update
  3. install from backport forced:
    apt-get install -t jeesie-backports python-usb

the other way (in that time, when backport still not have it the package) was downloading manually from unstalble and install manually using dpkg, that's all

for wheeze need to download manually the package and install with dpkg, will work due python 2.7 are default in wheeze and jeesie