From: John P. <joh...@st...> - 2007-04-03 11:25:03
|
Hi all I have a SWIG module fails to import on in IPython on Python 2.4.2 on Windows XP. But it works fine on Linux, and also works fine on Windows with the plain vanilla Python console. The funny thing is that the import error that IPython shows is different depending on the version of SWIG that I use to build my module. With SWIG 1.3.24, I get an error (see below) "'module' object has no attribute 'delete_exception'". But with SWIG 1.3.28 and 1.3.31 I get an error "'module' object has no attribute 'delete_steam_pT'". I am using MinGW GCC 3.4.5, but I have also tried with GCC 3.4.2 to no avail. As it looks like a version-sensitive thing with SWIG, I wonder if anyone here might have seen this problem or know how to fix it? Again note that this seems to work perfectly under Linux; this looks like only a Windows problem. Cheers JP PS the code is at http://freesteam.sf.net/ ---- 8< --error with SWIG 1.3.24---- 8< ---- In [1]: import freesteam --------------------------------------------------------------------------- exceptions.AttributeError Traceback (most recent call last) C:\Documents and Settings\john\<ipython console> C:\Python24\lib\site-packages\freesteam.py 37 38 ---> 39 class exception: 40 __swig_setmethods__ = {} 41 __setattr__ = lambda self, name, value: _swig_setattr(self, exceptio n, name, value) C:\Python24\lib\site-packages\freesteam.py in exception() 44 def __repr__(self): 45 return "<%s.%s; proxy of C++ std::exception instance at %s>" % ( self.__class__.__module__, self.__class__.__name__, self.this,) ---> 46 def __del__(self, destroy=_freesteam.delete_exception): 47 try: 48 if self.thisown: destroy(self) AttributeError: 'module' object has no attribute 'delete_exception' In [2]: ---- 8< --- error with SWIG 1.3.31 ---- 8< ---- In [2]: import freesteam --------------------------------------------------------------------------- exceptions.AttributeError Traceback (most recent call last) C:\Documents and Settings\john\<ipython console> C:\Python24\lib\site-packages\freesteam.py 141 steam_ps_swigregister(steam_ps) 142 --> 143 class steam_pT(_object): 144 __swig_setmethods__ = {} 145 __setattr__ = lambda self, name, value: _swig_setattr(self, steam_pT , name, value) C:\Python24\lib\site-packages\freesteam.py in steam_pT() 151 try: self.this.append(this) 152 except: self.this = this --> 153 __swig_destroy__ = _freesteam.delete_steam_pT 154 __del__ = lambda self : None; 155 def solve(*args): return _freesteam.steam_pT_solve(*args) AttributeError: 'module' object has no attribute 'delete_steam_pT' In [3]: -- John Pye Department of Mechanical and Manufacturing Engineering University of New South Wales, Sydney, Australia http://pye.dyndns.org/ |