Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 55 by [email protected]: SSHLibrary put_file and get_file does not work if filename contains URL encoding
http://code.google.com/p/robotframework-sshlibrary/issues/detail?id=55

We have problems with transferring files with SSHLibrary put_file and get_file keywords if given filename contains URL encoding characters.
We have used '%2F' to encode forward slash '/' character.

E.g. an_PLMN-PLMN%2FRNC-1%2FWBTS-55_12345.xml

Strange thing is that with some machines it works and some not even if having same below listed versions.

Python 2.7
SSHLibrary 1.0
Paramiko   1.7.7.1
Pycrypto   2.3
Robot Framework 2.7.3

Error produced by this problem:

*DEBUG* Source pattern matched local files: 'an_PLMN-PLMN%2FRNC-1%2FWBTS-55_12345.xml' *INFO* Putting 'an_PLMN-PLMN%2FRNC-1%2FWBTS-55_12345.xml' to '/tmp/an_PLMN-PLMN%2FRNC-1%2FWBTS-55_12345.xml'
Traceback (most recent call last):
  File "C:\Python27\lib\logging\__init__.py", line 846, in emit
    msg = self.format(record)
  File "C:\Python27\lib\logging\__init__.py", line 723, in format
    return fmt.format(record)
  File "C:\Python27\lib\logging\__init__.py", line 464, in format
    record.message = record.getMessage()
  File "C:\Python27\lib\logging\__init__.py", line 328, in getMessage
   msg = msg % self.args
TypeError: not enough arguments for format string
Logged from file sftp.py, line 132
Traceback (most recent call last):
  File "D:\python\src\lib\testingscript.py", line 20, in <module>
    ssh.put_file(filename, "/tmp/")
File "C:\Python27\lib\site-packages\SSHLibrary\__init__.py", line 540, in put_file
    {'CRLF': '\r\n', 'LF': '\n'}.get(newlines, None))
File "C:\Python27\lib\site-packages\SSHLibrary\client.py", line 21, in put_file
    remotefile = self._create_remote_file(dest, mode)
File "C:\Python27\lib\site-packages\SSHLibrary\pythonclient.py", line 115, in _create_remote_file
    self.sftp_client.chmod(dest, mode)
File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 388, in chmod
    self._log(DEBUG, 'chmod(%r, %r)' % (path, mode))
File "C:\Python27\lib\site-packages\paramiko\sftp_client.py", line 114, in _log super(SFTPClient, self)._log(level, "[chan %s] " + msg, *([ self.sock.get_name() ] + list(args)))
  File "C:\Python27\lib\site-packages\paramiko\sftp.py", line 132, in _log
    self.logger.log(level, msg, *args)
  File "C:\Python27\lib\logging\__init__.py", line 1203, in log



Actually if we modify paramiko's logging level the problem seems to disappear. But that's very weird solution.

import paramiko
import logging
logger = paramiko.util.logging.getLogger()
logger.setLevel(logging.CRITICAL)



Reply via email to