I am attempting to develop a component for 64 bit Redhawk that uses a 32 bit Python binary, but am not sure how to configure Redhawk use 32 bit Python instead of 64 bit Python when running this particular component. The reason I need to use 32 bit Python is because I am using a library (PyVisa, http://pyvisa.readthedocs.org/en/latest/) that only works with 32 bit Python (see https://decibel.ni.com/content/docs/DOC-2928).
I am using PyVisa to control lab equipment (i.e. Agilent signal generators) in order to a calibrate a receiver. I understand this may seem like a odd use of Redhawk, but tuning sig gens to a certain freq and power level is very similar to operations that need to be performed when controlling a receiver/transmitter as well.
I would rather not install 32 bit CentOS just to develop and test this 1 component and I'm assuming it will be equally troublesome to simultaneously install 32 bit and 64 bit Redhawk rpms on my system.
I have already installed 32 bit Python simultaneously with 64 bit Python on my system and have manually renamed the 32 bit Python binary to be "python_32" and placed it on the path (/usr/bin/). I tried to force Redhawk to use the 32 bit Python executable by changing the shebang at the top of my implementation file to
#!/usr/bin/env python_32
However, it didn't work, so then I tried
#!/usr/bin/python_32
which also didn't work.
See example below for a skeleton implementation, with all the boilerplate imports and function defs removed for clarity.
#!/usr/bin/python_32
import visa
def process(self):
sg = visa.instrument("TCPIP::10.2.8.236")
print sg.ask("*IDN?")
return NORMAL
Each time I attempt to launch a simple waveform containing this component, I receive the error below. This is the same error I receive when trying to use the PyVisa libary in 64 bit Python, which is why I think Redhawk is ignoring my shebang statements specifying the path to 32 bit Python.
OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: wrong ELF class: ELFCLASS32
Traceback (most recent call last):
File "/var/redhawk/sdr/dev/.DevMgr_orion/GPP_orion/components/sendSCPI/python/sendSCPI.py", line 9, in <module>
import visa
File "/usr/lib/python2.6/site-packages/PyVISA-1.5.dev0.dev-py2.6.egg/visa.py", line 237, in <module>
resource_manager = ResourceManager()
File "/usr/lib/python2.6/site-packages/PyVISA-1.5.dev0.dev-py2.6.egg/vpp43.py", line 85, in __new__
it.init(*args, **kwds)
File "/usr/lib/python2.6/site-packages/PyVISA-1.5.dev0.dev-py2.6.egg/visa.py", line 230, in init
self.session = self.vi = vpp43.open_default_resource_manager()
File "/usr/lib/python2.6/site-packages/PyVISA-1.5.dev0.dev-py2.6.egg/vpp43.py", line 788, in open_default_resource_manager
visa_library().viOpenDefaultRM(byref(session))
File "/usr/lib/python2.6/site-packages/PyVISA-1.5.dev0.dev-py2.6.egg/vpp43.py", line 162, in __call__
self.load_library()
File "/usr/lib/python2.6/site-packages/PyVISA-1.5.dev0.dev-py2.6.egg/vpp43.py", line 131, in load_library
self.__lib = self.__cdecl_lib = cdll.LoadLibrary(path)
File "/usr/lib64/python2.6/ctypes/__init__.py", line 431, in LoadLibrary
return self._dlltype(name)
File "/usr/lib64/python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: wrong ELF class: ELFCLASS32
For reference I am running Redhawk version 1.9.0. x64 on CentOS 6.4 x64.
If there is a better way to control my lab equipment through Redhawk, I'm open to that too.