[pygtk] Expected Behaviour of gnomevfs.XFER_NEW_UNIQUE_DIRECTORY

John Stowers john.stowers.lists at gmail.com
Mon Apr 23 17:56:02 WST 2007


Hey,

I am trying to copy files using gnomevfs using xfer_uri

I am unable to perform a copy from

foo/file1 to
foo/bar/file1

without first creating the bar directory. I thought that
gnomevfs.XFER_NEW_UNIQUE_DIRECTORY created all needed directories for
the copy - this does not seem to be the case however.

Is this a bug or a lack of my understanding? (see example code below)

Thanks

John

import gnomevfs

f1 = gnomevfs.URI("/home/john/Desktop/foo/bar.txt")
f2 = gnomevfs.URI("/home/john/Desktop/baz/Cheese/bar.txt")
f3 = gnomevfs.URI("/home/john/Desktop/baz/bar.txt")

mode = gnomevfs.XFER_OVERWRITE_MODE_REPLACE

print "Transfering File %s -> %s" % (f1, f3)
result = gnomevfs.xfer_uri(f1, f3,
                    gnomevfs.XFER_NEW_UNIQUE_DIRECTORY,
                    gnomevfs.XFER_ERROR_MODE_ABORT,
                    mode)

try:
    print "Transfering File %s -> %s" % (f1, f2)
    result = gnomevfs.xfer_uri(f1, f2,
                        gnomevfs.XFER_NEW_UNIQUE_DIRECTORY,
                        gnomevfs.XFER_ERROR_MODE_ABORT,
                        mode)
except gnomevfs.NotFoundError:
    print "STUPID GNOMEVFS BUG"


More information about the pygtk mailing list