100% no error run on Lab, error on Cloud

Good evening,
I uploaded my first pilot project to the Robocorp Cloud, and while the bot runs with zero errors on my local Robocorp Lab it gets a Unicode Error running on cloud (screenshot below):

I’m ready to push for delivery, just need to make sure the bot can get over that step on the Robocorp Cloud, any ideas? I can link any additional information if necessary

Thank you very much for the help,
Vasco

Hi, @JimmyYung!

Is the data in that CSV file confidential or can you share the file?

Does this work in Robocorp Lab if you run the robot using the Run Robot button on the top right?

Good morning,
I ran the bot using “Run Robot” on the top right, that is correct, it performed just as intended.

I can definitely share the file, please refer to the link http://vascofigueiredo.com/Robocorp.csv (it doesn’t allow me to attach to this reply)

I do have to add that when i try to open the .csv file in Robocorp Lab IDE i get the same error as in the Cloud log:

In my local IDE the error above does not stop the “Read table from CSV” command, and because all i really need is some bot variables storing the tables, i didn’t even care for the file, i have zero control over it’s encoding.

Thank you for the support as always @jani
All the best,
Vasco

Thanks for the file, will do some testing. When I open the file in Visual Studio Code, it definitely shows some encoding issues:

1 Like

Seems to work with Windows 1252 encoding:

1 Like

This gets really hack’ish really fast, but works:

encode.py:

def change_encoding(file_path, from_coding, to_coding):
    f = open(file_path, 'r', encoding=from_coding)
    content = f.read()
    f.close()
    f = open("converted.csv", 'w', encoding=to_coding)
    f.write(content)
    f.close()

The robot:

*** Settings ***
Library           RPA.Tables
Library           encode.py

*** Tasks ***
Test reading the CSV into a table
    Change Encoding    ${CURDIR}${/}Robocorp.csv    windows-1252    utf-8
    ${table}=    Read Table From Csv    ${CURDIR}${/}converted.csv

Anyway, the point here is that if you can change the encoding of the original file from windows-1252 to utf-8, everything should work after that.

2 Likes

Hi again,
That is exactly what i needed, i have no control over the encoding of the .csv file so i was just about to ask if you had any alternative to force it to utf-8. Amazing!
I will try out the solution and give feedback

Thank you very much, all the best
Vasco

Hi again,
The “hackish” solution seems to almost almost be working, for some reason it still can’t get through the position indicated in the log (below)

I first tried without sleep 10 seconds, but i wanted to test if the file had time to refresh before being fed to the table variable.
I’ll keep trying some stuff but without simulating the cloud environment i’m not sure how far i can take it.

Update: Im updating the file and not converting to a new one, i’ll make sure i try that out ASAP

Thank you,
Vasco

Good evening @jani
I totally misinterpreted the file encode.py, after figuring it out i re-worked the code and it’s running smoothly in the Cloud, execution was even faster than on my computer. Your solution was excellent, really good stuff.

Thank you very much for your help, all the best
Vasco

3 Likes