Skip to main content
AndyF
Navigator | Tier 3
August 9, 2022
Question

Returning utf-8 Base64 from python script

  • August 9, 2022
  • 2 replies
  • 951 views

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

    Cadet | Tier 2
    August 12, 2022

    please try

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

    AndyF
    AndyFAuthor
    Navigator | Tier 3
    August 12, 2022

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

    More of my own ramblings - https://www.lilysdad.com