[Python] How can I get the absolute path for a directory created with pyinfra?

Discussão em 'Python' iniciado por Stack, Janeiro 19, 2025.

  1. Stack

    Stack Membro Participativo

    I created a new directory with pyinfra using the relative path new_dir

    from pyinfra.operations import files, server

    files.directory("new_dir")


    Now I would like to get the absolute path of the new directory. I tried

    result = server.shell("pwd", _chdir="new_dir")
    print(result.stdout)


    But that only raises an exception:

    RuntimeError: Cannot evaluate operation result before execution


    How can I get the absolute path of the directory pyinfra created for me?

    Continue reading...

Compartilhe esta Página