use-agent issue with version 0.7.12 (lp:#1687291)

[Original report](https://bugs.launchpad.net/bugs/1687291) created by **Éric Lemoine (elemoine)**
```
I use the following command for backups:

    duplicity --verbosity info --full-if-older-than 1M --sign-key
5BBF59DF126FADEF --encrypt-key 57F334375840CA38 --use-agent --exclude-
filelist excludes.txt /home/elemoine file:///media/usb/backup

It fails with duplicity 0.7.12. This is the GPG error I get:

    GPG error detail: Traceback (most recent call last):
      File "/home/elemoine/.virtualenvs/duplicity/bin/duplicity", line
1546, in <module>
        with_tempdir(main)
      File "/home/elemoine/.virtualenvs/duplicity/bin/duplicity", line
1540, in with_tempdir
        fn()
      File "/home/elemoine/.virtualenvs/duplicity/bin/duplicity", line
1391, in main
        do_backup(action)
      File "/home/elemoine/.virtualenvs/duplicity/bin/duplicity", line
1521, in do_backup
        check_last_manifest(col_stats)  # not needed for full backup
      File "/home/elemoine/.virtualenvs/duplicity/bin/duplicity", line
1222, in check_last_manifest
        last_backup_set.check_manifests()
      File "/home/elemoine/.virtualenvs/duplicity/local/lib/python2.7/site-
packages/duplicity/collections.py", line 199, in check_manifests
        remote_manifest = self.get_remote_manifest()
      File "/home/elemoine/.virtualenvs/duplicity/local/lib/python2.7/site-
packages/duplicity/collections.py", line 234, in get_remote_manifest
        manifest_buffer = self.backend.get_data(self.remote_manifest_name)
      File "/home/elemoine/.virtualenvs/duplicity/local/lib/python2.7/site-
packages/duplicity/backend.py", line 679, in get_data
        assert not fin.close()
      File "/home/elemoine/.virtualenvs/duplicity/local/lib/python2.7/site-
packages/duplicity/dup_temp.py", line 226, in close
        assert not self.fileobj.close()
      File "/home/elemoine/.virtualenvs/duplicity/local/lib/python2.7/site-
packages/duplicity/gpg.py", line 279, in close
        self.gpg_failed()
      File "/home/elemoine/.virtualenvs/duplicity/local/lib/python2.7/site-
packages/duplicity/gpg.py", line 246, in gpg_failed
        raise GPGError(msg)
    GPGError: GPG Failed, see log below:
    ===== Begin GnuPG log =====
    gpg: Sorry, we are in batchmode - can't get input
    ===== End GnuPG log =====


    GPGError: GPG Failed, see log below:
    ===== Begin GnuPG log =====
    gpg: Sorry, we are in batchmode - can't get input
    ===== End GnuPG log =====

The same command completes without errors with 0.7.11. It sounds like a
gpg-agent/pinentry related issue. Is this a regression? Do I need to change
something in my Duplicity or/and GPG configuration?

This is what my gpg-agent.conf looks like:

    # set the defaut cache time to 2 hours
    default-cache-ttl 7200

    # set the max cache time to 8 hours
    max-cache-ttl 28800

    # use pinentry-gtk-2
    pinentry-program /usr/bin/pinentry-gtk-2

    # do not allow external cache
    no-allow-external-cache

Information:

duplicity version: 0.7.12
python version: 2.7.13
OS: Debian Sid
```

Story points: 12.0