[Python] Run another script from output exception

Discussão em 'Python' iniciado por Stack, Fevereiro 20, 2025.

  1. Stack

    Stack Membro Participativo

    I have something like this:

    try:
    response = requests.post(
    url, json=group, headers=self._headers, auth=self._auth
    )
    logger.info(f"API Response: {response.text}")
    return True
    except requests.exceptions.RequestException as e:
    logger.error(
    f"Failed to create group '{group['groupName']}'. "
    f"Exception: {str(e)}"
    )


    I'm getting some output if try is done for example: BLACK

    I'm getting some output if except is done for example: WHITE

    I have two spripts for example:

    • test1.py
    • test2.py

    I would like to run test1.py if output is BLACK

    I would like to run test2.py if output is WHITE

    How to do that?

    I expect run specific Python script from specific output.

    Continue reading...

Compartilhe esta Página