Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #11450 > unrolled thread
| Started by | Stefan Behnel <stefan_ml@behnel.de> |
|---|---|
| First post | 2011-08-15 12:08 +0200 |
| Last post | 2011-08-15 12:08 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Help needed with using SWIG wrapped code in Python Stefan Behnel <stefan_ml@behnel.de> - 2011-08-15 12:08 +0200
| From | Stefan Behnel <stefan_ml@behnel.de> |
|---|---|
| Date | 2011-08-15 12:08 +0200 |
| Subject | Re: Help needed with using SWIG wrapped code in Python |
| Message-ID | <mailman.7.1313402896.27778.python-list@python.org> |
Vipul Raheja, 15.08.2011 10:08: > I have wrapped a library from C++ to Python using SWIG. But I am facing > problems while importing and using it in Python. > > $ python > >>> import pyossimtest > >>> import pyossim > >>> a = ["Image1.png","Image2.png"] > >>> b = pyossimtest.Info() > >>> b.initialize(len(a),a) > Traceback (most recent call last): > File "<stdin>", line 1, in<module> > File "pyossimtest.py", line 84, in initialize > def initialize(self, *args): return _pyossimtest.Info_initialize(self, > *args) > TypeError: in method 'Info_initialize', argument 3 of type 'char *[]' > > What does this error message imply? I have already handled char** as a > special case in swig using typemaps. I have little experience with SWIG, so I can't comment much on the problem at hand, but what I can do is to encourage you to use Cython instead. It's faster, easier to use and much more versatile for writing Python wrappers than SWIG. Basically, it provides you with the full power and flexibility of a programming language, whereas SWIG (like all automatic wrapper generators) is always limiting because it has its predefined ways of wrapping things, and if they don't fit, you're on your own fighting up-hill against it. Stefan
Back to top | Article view | comp.lang.python
csiph-web