opening gvfs+ssh files from python

Elan Ruusamäe glen at delfi.ee
Sun Sep 11 13:02:00 CEST 2016


any ideas?

i.e how come truncate from bash works and not from python, and how to 
make it work

➔ python3 -c 
'open("/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt", "rb+")'
Traceback (most recent call last):
   File "<string>", line 1, in <module>
OSError: [Errno 95] Operation not supported: 
'/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt'

➔ python2 -c 
'open("/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt", "rb+")'
Traceback (most recent call last):
   File "<string>", line 1, in <module>
IOError: [Errno 95] Operation not supported: 
'/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt'

➔ ls -l /home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt
-rw-r--r-- 1 glen glen 0 sept  11 13:56 
/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt

➔ df /home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt
Filesystem     Type             Size  Used Avail Use% Mounted on
gvfsd-fuse     fuse.gvfsd-fuse  1,8T  1,8T   40G  98% /home/glen/.gvfs

➔ date> /home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt

➔ cat /home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt
P sept  11 13:57:21 EEST 2016


strace shows just C level error:
open("/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt", 
O_RDWR) = -1 EOPNOTSUPP (Operation not supported)

some more examples:
➔ strace -eopen truncate --size=0 
/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt
open("/home/glen/.gvfs/sftp:host=ewok.local/media/NEKO/pytest.txt", 
O_WRONLY|O_CREAT|O_NONBLOCK, 0666) = -1 EOPNOTSUPP (Operation not supported)


-- 
glen



More information about the pld-devel-en mailing list