简体   繁体   中英

Robot Framework Command Line Error | Getting Error 'utf8' codec can't decode byte 0xd0 in position 0: invalid continuation byte

I have a robot test suite which I need to execute from command line, later on I need to add the same to Jenkins. Here is my project structure which would help to understand how the code is written

在此处输入图片说明

What I need to do - I want to run the test suites that are present in folder Test_Suits from command line. These suits takes the input from excel files which are present inside folder Internal_Config_Lib_Files. I have written the excel read and write code in python which is shown as external python files in picture, please also note that the xls files doesn't have the data from any other language apart from English.

Please Note :- This code runs perfectly from Eclipse.

Command Being Used To Run Test Suite -

1.) cd To_Project_Location\Test_Suites\
2.) robot -A ..\..\Test_Utilities\File_Name.xls Test_Suite.robot

Errors I'm Getting

1.)Importing test library 'File_Name' failed: ImportError: No module named File_Name
2.)[ ERROR ] Opening argument file '..\..\Test_Utilities\File_Name.xls' failed: 'utf8' codec can't decode byte 0xd0 in position 0: invalid continuation byte

Configuration Details

1.) Python Version - Python 2.7.12

2.) Robot Framework - Robot Framework 3.1.2 (Python 2.7.12 on win32)

3.) Operating System - Windows 10

4.) Browser - Google Chrome Version 79

Questions -

1.) How can I fix these above 2 errors that are coming only for command line.

2.) After fixing would the same commands working for Jenkins or do I need to alter them as well.

3.) Is there any way by which I can create an EXE for this project from Eclipse.

You can't use a spreadsheet file with the -A/--argumentfile option. It needs to be a plain text file. Frankly, I don't see how it's possible that this code "runs perfectly from Eclipse" if eclipse is configured to use this argument in this way.

As to the import error, there's no way we can tell you how to solve it. It's telling you the literal truth: it can't find a module named File_Name , which you're apparently trying to import. Either you've spelled the module wrong, or it's somewhere other than where robot is looking.

You can use the same command line locally and in jenkins, assuming you've got the same directory structure and files in both places.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM