Python,SWIG and libjvm

sapsi saptarshi.guha at gmail.com
Thu Sep 20 19:00:36 EDT 2007


Hello,
I'm not sure if this the correct list but here goes (and sorry for the
noise). I've been attempting to wrap python around libhdfs.
So far so good (i've attached the SWIG template at the end). The
compilation works without errors and the shared objects do have
references to all the functions.

However, when importing into python

import pyhdfs

i get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/sguha/tmp/b/hdfs.py", line 7, in ?
    import _hdfs
ImportError: libjvm.so: cannot open shared object file: No such file
or directory

However, libjvm.so is located in /home/sguha/mine/jdk1.6.0_02/jre/lib/
amd64/server which is present in the PYTHONPATH and sys.path.
I can understand it complaining <i>while</i> loading the libjvm.so
but python doesn't locate it even when in the path.

As an aside, the build command for hdfs.c has "   -ljvm  " - this
should affect SWIG, right? Meaning if my program (e.g) links to a
library and i want a wrapper around my program (to python) i need SWIG
templates for my headers only and not for the linked library...right?
( I guess the answer is i dont otherwise that would be quite a
nightmare of work)

Thank you for your time
Saptarshi


Attachments:
SWIG template
%module pyhdfs

%{
#include "hdfs.h"
%}

%include "hdfs.h"




More information about the Python-list mailing list