Skip to main content
Question

Python script works on my PC but not on AA


Forum|alt.badge.img

Hi everyone,

I’m am developing a taskbot which integrates with Microsoft Graph APIs in order to get email attachments and download them locally.

Since the APIs returns the attachment data in base64 format, I developed a little Python script which basically decodes this data in bytes format and saves the file locally with the correct extension.

The script works correctly from my PC but when I run it from AA basically it return “bot error”. I can’t understand why it returns this and where actually is the error.

I copy and paste the Python script down below so you can see it:

import pathlib
import base64

def WriteAttachmentBytes(params: list()):
    filePath = pathlib.Path(params[0])
    fileContent = params[1]
    fileContent = base64.b64decode(fileContent)
    hasAttachmentWrote = bool()  
    try:
        with open(filePath, 'wb') as currentAttachment:
            currentAttachment.write(fileContent)
            hasAttachmentWrote = True
    except:
        hasAttachmentWrote = False
    return hasAttachmentWrote

(The input of the function is a list because I pass to the Python function two parameters)

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings