AttributeError: 'NoneType' object has no attribute 'encode'

Bug #1572598 reported by Tom Schnittke
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Duplicity
Invalid
Medium
Unassigned

Bug Description

Hello,

following situation:

i'm doing a backup with

duplicity v0.7.07.1 (0.7.07.1-0ubuntu0ppa1211~ubuntu15.10.1)
ubuntu 14.04 @ amd64

and using an remote SFTP(key-based-auth) server.

When i start it in a bash-session, thus, in a reqular terminal, everything works fine.
Backup runs through, without any complains.

But when i try to start it with cron i get following error (@ log level debug):

-------
...
Running 'sftp -oServerAliveInterval=15 -oServerAliveCountMax=2 <email address hidden>'
State = sftp, Before = '<email address hidden>'s'
Backtrace of previous error: Traceback (innermost last):
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 367, in inner_retry
    return fn(self, *args)
  File "/usr/lib/python2.7/dist-packages/duplicity/backend.py", line 569, in list
    return [tobytes(x) for x in self.backend._list()]
  File "/usr/lib/python2.7/dist-packages/duplicity/backends/ssh_pexpect_backend.py", line 280, in _list
    l = self.run_sftp_command(commandline, commands).split('\n')[1:]
  File "/usr/lib/python2.7/dist-packages/duplicity/backends/ssh_pexpect_backend.py", line 190, in run_sftp_command
    child.sendline(self.password)
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1036, in sendline
    n = self.send(s)
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 1024, in send
    s = self._coerce_send_string(s)
  File "/usr/lib/python2.7/dist-packages/pexpect/__init__.py", line 496, in _coerce_send_string
    return s.encode('utf-8')
 AttributeError: 'NoneType' object has no attribute 'encode'

-------
This message repeats 5 times with an interval of about 10 seconds or so and then duplicity quits.

@log-level info the main error part shown is:
" AttributeError: 'NoneType' object has no attribute 'encode'"

Please see the full backup.log attached.

Thanks!

Revision history for this message
Tom Schnittke (ilya-ruprecht) wrote :
Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

This sounds like either an older version of pexpect. Please run "sudo pip install --update pexpect" and try this again.

Changed in duplicity:
assignee: nobody → Kenneth Loafman (kenneth-loafman)
importance: Undecided → Medium
milestone: none → 0.7.08
status: New → In Progress
Revision history for this message
Tom Schnittke (ilya-ruprecht) wrote :

ok, will do.

current python-pexpect version installed is

dpkg -la|grep pexpect:
--------------
ii python-pexpect 3.1-1ubuntu0.1 all Python module for automating interactive applications
--------------

Revision history for this message
Tom Schnittke (ilya-ruprecht) wrote :

weird thing is, that is works when is start it interactively

Revision history for this message
Tom Schnittke (ilya-ruprecht) wrote :

*facepalm*

Sorry, my fault.

The ssh-key was NOT a default "~/.ssh/id_rsa" but a "~/.ssh/id_rsa_backup"

Thus, the backup-script, that calls hat a line
"ssh-add /root/.ssh/id_rsa_backup" but it had no effect in a noninteractive env, where no ssh-agent was running.

Thus, there was not key for duplicity.

So i'm calling now duplicity with "--ssh-options" -

 /usr/bin/duplicity --ssh-options="-oProtocol=2 -oIdentityFile='/root/.ssh/id_rsa_backup'" ....

and everything works fine.

Revision history for this message
Kenneth Loafman (kenneth-loafman) wrote :

Glad you found it!

Changed in duplicity:
assignee: Kenneth Loafman (kenneth-loafman) → nobody
status: In Progress → Invalid
Changed in duplicity:
milestone: 0.7.08 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.