[Python] teams notification webhook workflow in python script working on Windows, but not Linux

Discussão em 'Python' iniciado por Stack, Abril 9, 2025.

  1. Stack

    Stack Membro Participativo

    I have a python script that triggers a webhook to create a teams notification with the scripts progress. I'm using pymsteams for the script; which ultimately looks like this:

    def notify_teams(message):
    if debug_dry_run:
    return
    try:
    myTeamsMessage = pymsteams.connectorcard(
    "https://prod-09.westeurope.logic.azure.com:443/workflows/[webhookurl]")
    myTeamsMessage.text(message.replace("_", "-"))
    myTeamsMessage.send()
    except Exception as e:
    print('notify_teams failed: {}'.format(str(e)))


    When I run the python script from my windows machine (using PyCharm) the webhook works as expected. When I try to run it through the Linux server that I use to automate the script, it fails with the following error:

    The execution of template action 'Send_each_adaptive_card' failed: the result of the
    evaluation of 'foreach' expression '@triggerOutputs()?['body']?['attachments']'
    is of type 'Null'. The result must be a valid array.


    The version for Python on each machine is: Linux - Python 3.8.10 Windows - Python 3.9.12 Not sure if this would have an impact or not.

    Thanks

    Continue reading...

Compartilhe esta Página