Python, SWIG and other strange things

Posted by wanderameise on Stack Overflow See other posts from Stack Overflow or by wanderameise
Published on 2010-03-14T11:46:37Z Indexed on 2010/03/14 11:55 UTC
Read the original article Hit count: 333

Filed under:


I have a firmware for an USB module I can already control by visual C. Now I want to port this to python. for this I need the octopus library which is written in c. I found a file called octopus_wrap which was created by SWIG!

then I found a makefile which says:

python2.5: swig -python -outdir ./ ../octopus.i gcc -fPIC -c ../../liboctopus/src/octopus.c gcc -fPIC -c ../octopus_wrap.c -I /usr/include/python2.5 gcc -fPIC -shared octopus_wrap.o octopus.o /usr/lib/ -o

python2.4: swig -python -outdir ./ ../octopus.i gcc -fPIC -c ../../liboctopus/src/octopus.c gcc -fPIC -c ../octopus_wrap.c -I /usr/include/python2.4 gcc -fPIC -shared octopus_wrap.o octopus.o /usr/lib/ -o

win: gcc -fPIC -c ../../liboctopus/src/octopus.c -I /c/Programme/libusb-win32-device-bin- gcc -fPIC -c octopus_wrap.c -I /c/Python25/libs -lpython25 -I/c/Python25/include -I /c/Programme/libusb-win32-device-bin- gcc -fPIC -shared *.o -o _octopus.pyd -L/c/Python25/libs -lpython25 -lusb -L/c/Programme/libusb-win32-device-bin-

clean: rm -f octopus* _octopus*

install_python2.4: cp /usr/local/lib/python2.4/site-packages/ cp /usr/local/lib/python2.4/site-packages/

install_python2.5: cp /usr/local/lib/python2.5/site-packages/ cp /usr/local/lib/python2.5/site-packages/

I dont know how to handle this but as far as I can see and are the resulting output files which are relevant to python right?

luckily someone already did that and so I put those 2 files to my "python26/lib" folder (hope it doesnt matter if it´s python 2.5 or 2.6?!)

So when working with the USB device the is the library to work with! Importing this file makes several problems:

Traceback (most recent call last):
File "C:\Users\ameise\My Dropbox\µC\AVR\OCTOPUS\octopususb-0.5\demos\python    \", line 8, in <module>
from  octopus import *
File "C:\Python26\lib\", line 7, in <module>
import _octopus
ImportError: DLL load failed: module not found.

and here´s the related line 7 :

import _octopus

So there´s a problem considering the .so file! What could be my next step?

I know that´s a lot of confusing stuff but I hope anyone of you could bring some light in my mind!

thy in advance

© Stack Overflow or respective owner

Related posts about python

Related posts about usb