Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14185

Handle dependency in python file generated by SWIG

$
0
0

I have a swig generated python file like this :

from sys import version_info as _swig_python_version_infoif _swig_python_version_info < (2, 7, 0):    raise RuntimeError("Python 2.7 or later required")# Import the low-level C/C++ moduleif __package__ or "." in __name__:    from . import _FOOelse:    import _FOO

Due to some reason which is not the context of this problem, I have a dependency that before import _FOO I need to have "import BAR" line. Otherwise the cpp library _FOO would not be loaded correctly.I cannot find a simple directive in SWIG which can do this. I have tried writing many things like %pythoncode import BAR at the top of the SWIG interface (.i) file, still it only writes after this import _FOO line.Please give me a solution to this.


Viewing all articles
Browse latest Browse all 14185

Trending Articles