libnfs

# install libnfs
sudo apt-get install libnfs-dev
# set up 
git clone https://github.com/sahlberg/libnfs-python.git
cd libnfs-python/
cd libnfs/
make
# met error
cc -c -O2 -fPIC -I/usr/include $(python2.7-config --cflags) libnfs_wrap.c
/bin/sh: 1: python2.7-config: not found
libnfs_wrap.c:149:11: fatal error: Python.h: No such file or directory
 # include <Python.h>
           ^~~~~~~~~~
compilation terminated.
Makefile:12: recipe for target 'libnfs_wrap.o' failed
make: *** [libnfs_wrap.o] Error 1
# solution:  sudo apt-get install python-dev # for python 2.7
# it only works for python 2.7

# Miroslav Klivansky: https://www.youtube.com/watch?v=smnshI7ol68
# test 
# https://github.com/sahlberg/libnfs-python
import libnfs
nfs = libnfs.NFS('nfs://198.18.0.100/test')
a=nfs.open('/foo-test', mode='w+')
a.write("Test string")
a.close()
print nfs.open('/foo-test', mode='r').read()

Last updated