Skip to content

Conversation

jhollowe
Copy link

If the port is an int, scp fails due to scp_command's final b_list trying to convert the int to a string which does not work.

This mirrors what ssh_command does.

e.g. with a port number (before fix)

>>> ret = conn.scp(("test.txt",), target="/root/test.txt")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/openssh_wrapper.py", line 219, in scp
    scp_command = self.scp_command(filenames, target)
  File "/usr/local/lib/python3.7/site-packages/openssh_wrapper.py", line 372, in scp_command
    return b_list(cmd)
  File "/usr/local/lib/python3.7/site-packages/openssh_wrapper.py", line 46, in b_list
    return [b(item) for item in items]
  File "/usr/local/lib/python3.7/site-packages/openssh_wrapper.py", line 46, in <listcomp>
    return [b(item) for item in items]
  File "/usr/local/lib/python3.7/site-packages/openssh_wrapper.py", line 30, in b
    return string.encode('utf-8')
AttributeError: 'int' object has no attribute 'encode'

@jhollowe
Copy link
Author

PR #13 is better, I just wanted to put in a quick fix and draw attention to this issue and that its solution is easy to implement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant