"IOError: [Errno 95] Operation not supported"

1225159667000 » Tagged as: Python , weird , X11

To my great surprise (nay shock), I found that you cannot redirect output to /dev/null with cat for certain file types. For example  cat dsl-n-01RC4.iso > /dev/null will result in the following error:

cat: dsl-n-01RC4.iso: Operation not supported

Surely this cannot be? Yet, cat works fine for other files - notably text files. I was trying this out to test the speed of my network and also the speeds of different protocols such as samba, FTP , NFS etc et. The plan was to mount a remote folder locally, get the contents of a large file and dump it on /dev/null  . Since cat didn't work out I thought I would try making a small python script. I was pleasantly surprised by how easy it is with python. Just 5 lines of code really. It did work for the first file I tried but soon as I tried a binary, I ran into this error:

IOError: [Errno 95] Operation not supported

I reckon that reading a line at a time make python operate in the same way cat does. I tried to switch over to binary reads but the problem didn't go away. I was getting frustrated because I could easily copy the same files using nautilus, then I thought I would try cp. Lo and behold that fails too.

cp: reading `dsl-n-01RC4.iso': Operation not supported

Then I tried rsync and received a meaningful error:

rsync: read errors mapping "/home/raditha/.gvfs/ftp as raditha on radmedia/home/raditha/Download/winxp.iso": Operation not supported (95) rsync: read errors mapping "/home/raditha/.gvfs/ftp as raditha on radmedia/home/raditha/Download/winxp.iso": Operation not supported (95) ERROR: winxp.iso failed verification -- update discarded. rsync error: some files could not be transferred (code 23) at main.c(1031) [sender=3.0.2 I had seen rsync choke on paths with spaces on it. So I immidiately leapt to the conclusion that the spaces in the gvfs pathname could be the reason for the errors. So I tried creating a symbolic link to the gvfs mounted folder without spaces in it's pathname. This had worked for me before with rsync but this time around it didn't work with either. In the end the real culprit turned out to be GVFS. Apparently you cannot use cp, cat, rsync etc on a remote folder that is mounted through gvfs. In other words if you suse this commands on a folder inside your .gvfs you are certain to run into one of the above error. What is the solution then? To use a 'gvfs aware' application. There are precious few around at the time but nautilus certainly is one. That does effectively rule out writing shell scripts for certain automated tasks.

comments powered by Disqus