[Libguestfs] [nbdkit] can't import mmap

Jason Pepas jasonpepas at gmail.com
Thu Oct 29 14:19:03 UTC 2015


Hi,

I'm new to nbdkit and am trying to run a simple "single file block
device using mmap" setup, using this python script:

import mmap

def config(key, value):
    print ("ignored parameter %s=%s" % (key, value))

def open(readonly):
    print ("open: readonly=%d" % readonly)
    f = open("disk","r+")
    m = mmap.mmap(f.fileno(), 0, access=mmap.ACCESS_WRITE)
    return (f,m)

def get_size(h):
    size = 1024*1024

def pread(h, count, offset):
    (f,m) = h
    bytes = bytearray(m[offset:offset+count])
    return bytes

def pwrite(h, buf, offset):
    (f,m) = h
    m[offset:offset+len(buf)] = bytearray(buf)


When I run this:

/usr/sbin/nbdkit -f -v python script=single_file.py


I get this error:

nbdkit: debug: registering
/usr/lib/x86_64-linux-gnu/nbdkit/plugins/nbdkit-python-plugin.so
nbdkit: debug: registered
/usr/lib/x86_64-linux-gnu/nbdkit/plugins/nbdkit-python-plugin.so (name
python)
nbdkit: debug: /usr/lib/x86_64-linux-gnu/nbdkit/plugins/nbdkit-python-plugin.so:
load
nbdkit: debug: /usr/lib/x86_64-linux-gnu/nbdkit/plugins/nbdkit-python-plugin.so:
config key=script, value=single_file.py
Traceback (most recent call last):
  File "single_file.py", line 1, in <module>
    import mmap
ImportError: /usr/lib/python2.7/lib-dynload/mmap.x86_64-linux-gnu.so:
undefined symbol: PyExc_SystemError
nbdkit: error: single_file.py: error running this script


Any ideas?

Thanks,
Jason Pepas




More information about the Libguestfs mailing list