Python library interface

I was trying to test something through the python interface today, and I
get two strange errors. The first is blocking, and may be due to an old
version of a file:

% python demo.py
Traceback (most recent call last):
   File "demo.py", line 25, in <module>
     from lammps import LMPINT as INT
ImportError: cannot import name LMPINT

I recall a previous version of lammps.py having LMPINT, LMPDOUBLE, etc.
defined in it, but those are no longer there. Does demo.py need to be
updated, or am I doing something wrong? I haven't used the Python
interface much at all, so I very well could be!

The second error occurs when I use a parallel library (through OpenMPI, in
my case) instead of a serial library. I get the following error:
   python: symbol lookup error:
   /usr/lib64/openmpi/lib/openmpi/mca_paffinity_hwloc.so: undefined symbol:
   mca_base_param_reg_int
I found a link here:
   http://www.open-mpi.org/faq/?category=running#loading-libmpi-dynamically
indicating that changing lammps.py, lines 26-27, from
       if not name: self.lib = CDLL("liblammps.so")
       else: self.lib = CDLL("liblammps_s\.so&quot; name)
to
       if not name: self.lib = CDLL("liblammps.so", RTLD_GLOBAL)
       else: self.lib = CDLL("liblammps_s\.so&quot; name, RTLD_GLOBAL)
will solve the problem, and I can confirm it does (at least for me). The
problem happens because MPI loads some other libraries, but the namespace
created by CDLL is not global and therefore it can't find those symbols.
RTLD_GLOBAL puts them in the global namespace for library symbols.

Karl D. Hammond
University of Tennessee, Knoxville

"You can never know everything, and part of what you know is always
   wrong. A portion of wisdom lies in knowing that. A portion of courage
   lies in going on anyway."
"Nothing ever goes as you expect. Expect nothing, and you will not be
   surprised."

demo.py was out-of-date. I'll post a patch this
AM, and include the RTLD_GLOBAL flag on CDLL().

Thanks,
Steve