sahlberg / libnfs-python

Python bindings for libnfs
GNU Lesser General Public License v2.1
64 stars 34 forks source link

NFS object does not have attribute isdir, isfile ect. #42

Open cnc0090306 opened 3 years ago

cnc0090306 commented 3 years ago
nfs = libnfs.NFS('nfs://{SERVER}/{RESOURCE}/')
nfs.isdir("/{DIR}/)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'NFS' object has no attribute 'isdir'
dir(nfs)
['__class__', '__del__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_nfs', '_url', 'listdir', 'lstat', 'mkdir', 'open', 'rmdir', 'stat', 'unlink']
sahlberg commented 3 years ago

isdir() should be there. Maybe you are using an old version of the wrapper?

Try installing libnfs from current master and try installing libnfs-python from current master.

I just pushed a small change to libnfs-python to switch it to python3 and using current master of both libnfs and libnfs-python the nfs.isdir() method works for me in testing.

I verified that these instructions worked: This module depends on and provides bindings for libnfs, a userspace NFS library hosted at https://github.com/sahlberg/libnfs

Before you can build this module you must first install the latest version of libnfs.

Building and installing

cd libnfs make cd .. sudo python3 setup.py install