duplicity crashes with tmp files when gpg2 installed instead of gpg (lp:#710198)

[Original report](https://bugs.launchpad.net/bugs/710198) created by **pierre (mkzuot)**
```
Hello,
I use duplicity on my computer, and wished to use it on a Qnap NAS.
duplicity was packaged for ipkg system for this hardware, and that is a
good idea !
So, I import my GPG test keys and scripts, but duplicity crash with tmp
directorys. I checked free space, permissions, and there is no problem. I
run the script as admin on the NAS.

Below is the -v9 trace:

admin@JD pierretest # ./RemoteBackup.sh
2011-01-30_16:04:08: Backup for local filesystem started
2011-01-30_16:04:08: ... removing old backups
Local and Remote metadata are synchronized, no sync needed.
Last full backup date: none
No old backup sets found, nothing deleted.
2011-01-30_16:04:09: ... backing up filesystem
Using archive dir: /root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8
Using backup name: 450b79617daa87d1ac397876cf9eb4c8
Import of duplicity.backends.hsibackend Succeeded
Import of duplicity.backends.sshbackend Succeeded
Import of duplicity.backends.webdavbackend Succeeded
Import of duplicity.backends.localbackend Succeeded
Import of duplicity.backends.imapbackend Succeeded
Import of duplicity.backends.rsyncbackend Succeeded
Import of duplicity.backends.tahoebackend Succeeded
Import of duplicity.backends.giobackend Failed: No module named gio
Import of duplicity.backends.ftpbackend Succeeded
Import of duplicity.backends.cloudfilesbackend Succeeded
Import of duplicity.backends.botobackend Succeeded
Main action: full
================================================================================
duplicity 0.6.11 (November 20, 2010)
Args: /opt/bin/duplicity full -v9 --encrypt-key=7B4DD872 --sign-
key=7B4DD872 --volsize=20 --tempdir=/share/MD0_DATA/pierretest/temp
/share/MD0_DATA/pierretest/animaux_fond_ecran
file:///share/MD0_DATA/pierre3home/test
Linux JD 2.6.33.2 #1 Wed Jan 5 02:06:35 CST 2011 armv5tel
/opt/bin/python2.6 2.6.6 (r266:84292, Nov 29 2010, 23:41:28)
[GCC 4.2.3]
================================================================================
Using temporary directory /share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-
tempdir
Registering (mkstemp) temporary file
/share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-tempdir/mkstemp-sg5M2u-1
Temp has 945400791040 available, backup will use approx 27262976.
Local and Remote metadata are synchronized, no sync needed.
0 files exist on backend
0 files exist in cache
Extracting backup chains from list of files: []
Last full backup date: none
Collection Status
-----------------
Connecting with backend: LocalBackend
Archive dir: /root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8

Found 0 secondary backup chains.
No backup chains with active signatures found
No orphaned or incomplete backup sets found.
Using temporary directory
/root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8/duplicity-A1kupI-
tempdir
Registering (mktemp) temporary file
/root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8/duplicity-A1kupI-
tempdir/mktemp-UVriHK-1
Using temporary directory
/root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8/duplicity-N8zqdB-
tempdir
Registering (mktemp) temporary file
/root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8/duplicity-N8zqdB-
tempdir/mktemp-vd5hSf-1
AsyncScheduler: instantiating at concurrency 0
Registering (mktemp) temporary file
/share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-tempdir/mktemp-nvwoDJ-2
Selecting /share/MD0_DATA/pierretest/animaux_fond_ecran
Comparing () and None
Getting delta of (() /share/MD0_DATA/pierretest/animaux_fond_ecran dir) and
None
A .
Removing still remembered temporary file
/share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-tempdir/mkstemp-sg5M2u-1
Cleanup of temporary file /share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-
tempdir/mkstemp-sg5M2u-1 failed
Removing still remembered temporary file
/share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-tempdir/mktemp-nvwoDJ-2
Cleanup of temporary file /share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-
tempdir/mktemp-nvwoDJ-2 failed
Cleanup of temporary directory /share/MD0_DATA/pierretest/temp/duplicity-
GMSDaL-tempdir failed - this is probably a bug.
Traceback (most recent call last):
  File "/opt/bin/duplicity", line 1245, in <module>
    with_tempdir(main)
  File "/opt/bin/duplicity", line 1238, in with_tempdir
    fn()
  File "/opt/bin/duplicity", line 1211, in main
    full_backup(col_stats)
  File "/opt/bin/duplicity", line 417, in full_backup
    globals.backend)
  File "/opt/bin/duplicity", line 295, in write_multivol
    globals.gpg_profile, globals.volsize)
  File "/opt/lib/python2.6/site-packages/duplicity/gpg.py", line 275, in
GPGWriteFile
    bytes_to_go = data_size - get_current_size()
  File "/opt/lib/python2.6/site-packages/duplicity/gpg.py", line 267, in
get_current_size
    return os.stat(filename).st_size
OSError: [Errno 2] No such file or directory:
'/share/MD0_DATA/pierretest/temp/duplicity-GMSDaL-tempdir/mktemp-nvwoDJ-2'

Removing still remembered temporary file
/root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8/duplicity-A1kupI-
tempdir/mktemp-UVriHK-1
Removing still remembered temporary file
/root/.cache/duplicity/450b79617daa87d1ac397876cf9eb4c8/duplicity-N8zqdB-
tempdir/mktemp-vd5hSf-1
close failed in file object destructor:
IOError: [Errno 32] Broken pipe
2011-01-30_16:04:10: Backup for local filesystem complete
2011-01-30_16:04:10: ------------------------------------

I export my GPG passphrase... I am just testing locally (later, I would
like to do it on a ftp).
I looked at previous bugs, I looked at -v9 trace on my computer, and I
can't understand the problem.
It is duplicity 0.6.11   (0.6.10 on my computer), Python 2.6.6  (same on my
computer).
Really, I don't understand.
Where should I look?

only difference is :
Import of duplicity.backends.giobackend Failed: No module named gio
but I don't know what I should install to solve this.

Many thanks if someone could give me a clue to investigate...
```

Story points: 64.0