yanne / api-test

0 stars 0 forks source link

SSHLibrary Write fails when prompt is not set #121

Closed yanne closed 10 years ago

yanne commented 10 years ago

What steps will reproduce the problem?

  1. Open SSH connection and login to Linux machine
  2. Write 'ls' (or any other string)

What is the expected output? What do you see instead?

Expected output: clear error message, like 'Write failed, use Set Prompt first'

Instead, I get:

08:38:57.197 TRACE Arguments: [ write ] 08:38:57.526 INFO Writing 'write\n' 08:38:57.526 INFO Opening new channel 08:38:57.526 FAIL TypeError: expected a character buffer object 08:38:57.526 INFO Traceback (most recent call last): File "C:\Python25\Lib\site-packages\SSHLibraryinit.py", line 271, in write self.write_bare(text) File "C:\Python25\Lib\site-packages\SSHLibraryinit.py", line 283, in write_bare self.client.write(text, self._prompt) File "C:\Python25\Lib\site-packages\SSHLibrary\pythonclient.py", line 66, in write print 'INFO %s' % self.read_until(prompt, 30) File "C:\Python25\Lib\site-packages\SSHLibrary\pythonclient.py", line 83, in read_until if data.count(expected) > 0:

What version of the product are you using? On what operating system?

lib 0.5 + Windows XP. Same behaviour on Linux

Please provide any additional information below.

This issue was originally opened at Google Code on Jul 21, 2008.

yanne commented 10 years ago

Original comment by lau...@gmail.com on Jul 22, 2008.

I'm not sure but most likely the prompt needs to be set before Write (and other related keywords) work. This should be documented better and the error message should definitely be better.

yanne commented 10 years ago

Original comment by janne.t....@gmail.com on Aug 5, 2008.

Fixed in r10 and r13 (code and docs, respectively) SSHLibrary version 0.6 will released tomorrow.