
robotframework - issue #1707
"Create File" (OperatingSystem Library) cannot write binary data which should not be encoded
Hi everybody!
There is a problem with "Create File" keyword from OperatingSystem library. It seems it can't always handle binary data such as PDF.
I use this keyword following way:
Create File blablabla.pdf ${payload}
The result with debugging on is following:
20140228 17:05:02.298 - INFO - +----- START KW: OperatingSystem.Create File [ blablabla.pdf | ${payload} ] 20140228 17:05:02.317 - FAIL - UnicodeDecodeError: 'ascii' codec can't decode byte 0x83 in position 11: ordinal not in range(128) 20140228 17:05:02.318 - DEBUG - Traceback (most recent call last): File "C:\Python27\lib\site-packages\robot\libraries\OperatingSystem.py", line 611, in create_file path = self._write_to_file(path, content, encoding, 'w') File "C:\Python27\lib\site-packages\robot\libraries\OperatingSystem.py", line 630, in _write_to_file f.write(content.encode(encoding)) 20140228 17:05:02.318 - INFO - +----- END KW: OperatingSystem.Create File (20)
My PDF content comes from the ImapLibrary and the guys that support ImapLibrary already debugged this issue and they suspect that there is a problem with the "Create File" keyword, see here:
https://github.com/lovelysystems/robotframework-imaplibrary/issues/17
Regards, mr
Robot Framework version: 2.8.4
used interpreter: Python, version 2.7.5
operating system: Windows 7
output of pybot --version
command: Robot Framework 2.8.4 (Python 2.7.5 on win32)
Comment #1
Posted on May 12, 2014 by Happy RhinoWe've already implemented Create Binary File and it will be part of 2.8.5 release.
Status: Duplicate
Labels:
Type-Defect
Priority-Medium