Cygwin: TypeError: basis_file must be a (true) file, while restoring inremental backup

Bug #670891 reported by ChieftainY2k on 2010-11-04
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

I am unable to restore files from incremental backup, while restoring files from FULL backup seems to be ok.

The error is "TypeError: basis_file must be a (true) file"

This is a major problem for me , since I use duplicity on a daily basis to back up my windows documents and files.

Backup storage is local drive.

All backed up files are from local drive.

See attachment for details.

Windowx XP SP3 + latest cygwin.

Error summary:

bash-3.2$ uname -a
CYGWIN_NT-5.1 cy2k 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin

bash-3.2$ duplicity --version
duplicity 0.6.10

bash-3.2$ python --version
Python 2.6.5

Error Stack Trace:

Traceback (most recent call last):
  File "/usr/bin/duplicity", line 1245, in <module>
  File "/usr/bin/duplicity", line 1238, in with_tempdir
  File "/usr/bin/duplicity", line 1192, in main
  File "/usr/bin/duplicity", line 539, in restore
  File "/usr/lib/python2.6/site-packages/duplicity/", line 520, in Write_ROPaths
    for ropath in rop_iter:
  File "/usr/lib/python2.6/site-packages/duplicity/", line 493, in integrate_patch_iters
    final_ropath = patch_seq2ropath( normalize_ps( patch_seq ) )
  File "/usr/lib/python2.6/site-packages/duplicity/", line 478, in patch_seq2ropath "rb" ) )
  File "/usr/lib/python2.6/site-packages/duplicity/", line 167, in __init__
    raise TypeError("basis_file must be a (true) file")
TypeError: basis_file must be a (true) file

Revision history for this message
ChieftainY2k (chieftainy2k) wrote :
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 using cygwin 1.7.7 and python 2.6.5 on Windows 7.

The problem is that, as explained in the Python documentation (, 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://<email address hidden>/msg00675.html

I found a workaround (patch attached) by replacing in src/ "tempfile.TemporaryFile()" with "os.tmpfile()", which, instead, returns a file object (

Hope it helps,


Changed in duplicity:
importance: Undecided → Medium
milestone: none → 0.6.12
status: New → Fix Committed
Changed in duplicity:
status: Fix Committed → In Progress
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers