Eclipse Pydev: Supress no-self errors in python wrappers generated with swig

Posted by Christian on Stack Overflow See other posts from Stack Overflow or by Christian
Published on 2010-03-12T08:52:39Z Indexed on 2010/03/12 8:57 UTC
Read the original article Hit count: 552

Filed under:
|
|
|

Hi,

when generating python wrappers with swig the python wrapper classes in the generated python file do not have an explicit self parameter, for example see below:

class PySwigIterator(_object):
    def value(*args): return _spatiotemporalnmf.PySwigIterator_value(*args)
    def incr(*args): return _spatiotemporalnmf.PySwigIterator_incr(*args)
    def decr(*args): return _spatiotemporalnmf.PySwigIterator_decr(*args)
    def distance(*args): return _spatiotemporalnmf.PySwigIterator_distance(*args)

I am developing with the eclipse pluging Pydev. Pydev always shows an error when it detects a method without explicit self parameter. I am aware of two methods to get rid of the errors: First, disable error checking for the whole project in the Pydev preferences. Second, add a #@NoSelf to every line with an error. I don't want to use the first one, because I still want to get error warnings for my non-swig-generated files. Obviously the second one is also not very good, because I would have to do it by hand and every time I generate the file again, all #@NoSelfs will be gone.

My Question now is, is there a better way to achieve this?

Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about swig