[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] [nbdkit] can't import mmap



Thanks!

Sent from my iPhone

> On Oct 29, 2015, at 9:55 AM, Richard W.M. Jones <rjones redhat com> wrote:
> 
>> On Thu, Oct 29, 2015 at 09:19:03AM -0500, Jason Pepas wrote:
>> 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?
> 
> It's probably this bug:
> 
> https://bugzilla.redhat.com/1223870
> 
> Fixed in this commit:
> 
> https://github.com/libguestfs/nbdkit/commit/77f4982e65840b6edff5e97d3dbdf140f7e3229b
> 
> 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]