Comment 2 for bug 670891

Revision history for this message
Paolo Costa (paolinux) wrote :

Hi there,

I bumped into the same problem while running duplicity 0.6.11 (patched as of http://jager.no/projects/windows/duplicity-on-windows) using cygwin 1.7.7 and python 2.6.5 on Windows 7.

The problem is that, as explained in the Python documentation (http://docs.python.org/library/tempfile.html), tempfile.TemporaryFile returns a *file-like* object, not a file object. Under Linux, it effectively returns a file object but under windows it does not. Hence, the type of the object returned is *not* a types.FileType, causing the exception to be raised.

Further references:

http://bytes.com/topic/python/answers/36024-bug-windows-tempfile-py
http://<email address hidden>/msg00675.html

I found a workaround (patch attached) by replacing in src/patchdir.py "tempfile.TemporaryFile()" with "os.tmpfile()", which, instead, returns a file object (http://docs.python.org/library/os.html).

Hope it helps,

Paolo