Skip to content

Libdoc doesn't handle bytes containing non-ASCII characters in keyword arguments #3259

@kenifanying

Description

@kenifanying

Hi,

I have a library written in python, and the default arguments of the library's constructor contain Chinese character. It will throw exception if i try to generate the xml file using python -m robot.libdoc lib\wifi_action.py libdoc.xml

C:\Users\tony\robotframework\para-demo>python -m robot.libdoc lib\wifi_action.py
 libdoc.xml
Unexpected error: WindowsError: [Error 32] : u'libdoc.xml'
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\robot\utils\application.py", line 83, in _
execute
    rc = self.main(arguments, **options)
  File "C:\Python27\lib\site-packages\robot\libdoc.py", line 158, in main
    libdoc.save(output, self._get_output_format(format, output))
  File "C:\Python27\lib\site-packages\robot\libdocpkg\model.py", line 53, in sav
e
    LibdocWriter(format).write(self, outfile)
  File "C:\Python27\lib\site-packages\robot\libdocpkg\output.py", line 38, in __
exit__
    os.remove(self._output_path)

I upload the demo project para-demo.zip

para-demo.zip

I can confirm this is a probem of the robotframework under python 2.7, it works fine under python 3.7.4, see nokia/RED#317

C:\Users\tony\robotframework\para-demo>py -3 -m robot.libdoc lib\wifi_action.py
libdoc.xml
C:\Users\tony\robotframework\para-demo\libdoc.xml

Python 2.7.16
Robot Framework 3.1.1 (Python 2.7.16 on win32)
RED - Robot Editor version 0.8.13
System: Windows 7 SP1 X86_64

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions