Question

Returning utf-8 Base64 from python script

  • 9 August 2022
  • 2 replies
  • 96 views

Badge +4

Hi Community

 

Hope you can help me with this one, I am starting to run out of hair to pull out over this one 😀

 

I have a python script that takes a string input, converts it into a UTF-8 Base64 variable and then passes it back.

 

When I run it inside the python script it works and gives me the correct variable, however when I run it via AA360 it returns "Bot Error".

 

Incidentally, there is nothing logged in the log file when the bot runs the script.

 

Any Ideas?

 

 

Python Script

 

import base64

import logging

 

def ConvertText(data):

    # Configure the logging system

    logging.basicConfig(filename ='app.log', level = logging.DEBUG)

 

    logging.info(data)

   

    datatoretrn = base64.b64encode(bytes(data,'utf-8'))

    logging.info (datatoretrn)

 

    return datatoretrn

 

Bot

 

image 

Error occurs on line 5

 

image 

 


2 replies

please try

datatoretrn = str(base64.b64encode(bytes(data,'utf-8')))

Badge +4

@SATOU Takeo​ That is brilliant and so simple that I didn't even think of that. Great help! Kudos!🎉

Reply