Skip to content

Channel Exception on write with buffer API objects #968

Closed

Description

@bz2

Similar to #967, the paramiko socket-like Channel.send() method throws an Exception if passed an object that implements the buffer API, such as the builtin memoryview type.

From the Channel docstring:

A Channel is meant to behave like a socket, and has an API that should be indistinguishable from the Python socket API.

Traceback (most recent call last):
  ...
  File ".../osutils.py", line 2181, in send_all
    sent = sock.send(view[sent_total:sent_total+MAX_SOCKET_CHUNK])
  File ".../paramiko/channel.py", line 715, in send
    return self._send(s, m)
  File ".../paramiko/channel.py", line 1080, in _send
    m.add_string(s[:size])
  File ".../paramiko/message.py", line 285, in add_string
    s = asbytes(s)
  File ".../paramiko/common.py", line 170, in asbytes
    raise Exception('Unknown type')
Exception: Unknown type

A native socket raises TypeError for send with non string or buffer types.

Activity

  1. added 2 commits that reference this issue on May 25, 2017
    d97afed
    102ed5d
  2. bitprophet commented on May 31, 2017

    @bitprophet
    Member

    Rolling into the final PR. Thanks!

  3. added 2 commits that reference this issue on Jun 9, 2017
    c2c402c
    17231b9
  4. added 2 commits that reference this issue on Jun 7, 2018
    861666d
    df710f7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions