[Libguestfs] [nbdkit python]: unable to locate modules

Richard W.M. Jones rjones at redhat.com
Thu May 21 08:40:38 UTC 2015


On Thu, May 21, 2015 at 09:32:48AM +0100, Richard W.M. Jones wrote:
> On Thu, May 21, 2015 at 12:10:13AM -0400, Bill Speirs wrote:
> > I'm working on a python plugin for nbdkit that treats Google Cloud
> > Storage as a block device. I have a library, gcs.py, that implements
> > simple commands: list, get, put, delete; source is here:
> > https://github.com/wspeirs/cldblkdev/blob/master/gcs.py
> > 
> > When I attempt to run nbdkit I get the following error:
> 
> I get a slightly different error:
> 
> Traceback (most recent call last):
>   File "/tmp/gcs.py", line 1, in <module>
>     import json
>   File "/usr/lib64/python2.7/json/__init__.py", line 108, in <module>
>     from .decoder import JSONDecoder
>   File "/usr/lib64/python2.7/json/decoder.py", line 5, in <module>
>     import struct
>   File "/usr/lib64/python2.7/struct.py", line 1, in <module>
>     from _struct import *
> ImportError: /usr/lib64/python2.7/lib-dynload/_struct.so: undefined symbol: PyFloat_Type
> nbdkit: error: /tmp/gcs.py: error running this script
> 
> A smallest possible reproducer is to have a file that has a single line:
> 
>   import json

I can fix it (for my simple json case) by doing:

LD_PRELOAD=/usr/lib64/python2.7/lib-dynload/_json.so nbdkit python script=/tmp/json.py

I wonder why Python doesn't dlopen the correct shared libraries?

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
libguestfs lets you edit virtual machines.  Supports shell scripting,
bindings from many languages.  http://libguestfs.org




More information about the Libguestfs mailing list