Parsing '-d' failed: File or directory to execute does not exist

Hello all!

When I run a robot script in parallel using pabot executing the script.py
Then all expected execution is completed
But the output files are created in the root project folder MyProject instead of MyProject/output

Trying to solve that, I tried to add the robot parameter “-d” as showed in the script_modified.py. However, the folder is not found even it existing.

Result with new script_modified.py :

The following are observed in the prompt

Contêiner do Selenium Hub criado com sucesso.
882c400b0922d16e8953b69cf1567826a6589342f163ba7b2b4610afd53f4547
Contêiner do Selenium Node Chrome do Médico 1 criado com sucesso.
caba5588b530667868c158872cea7c22df69178498b13c973ccf6b48c756aa9f
Contêiner do Selenium Node Chrome do Paciente 1 criado com sucesso.
Checking log directory: C:\Users\arauj\myproject\output
Directory found: C:\Users\arauj\myproject\output
Parsing '-d' failed: File or directory to execute does not exist.
Total testing: 0.0 seconds
Elapsed time:  0.0 seconds

Result with previous script.py :

As you can see below, the report.html, output.html and output.xml were created in the C:\Users\arauj\myproject\report.html

913306e6bff69e3e0105681d0ed8bd2ffd3681c40e81f30ee130d0a06fa47850
Contêiner do Selenium Hub criado com sucesso.
65c07552dab3c2e7a72c2afceadbe87d541b1d3dc45ccf135ec61f1f114e41bc
Contêiner do Selenium Node Chrome do Médico 1 criado com sucesso.
797af93a8b4820fcc62707180a3cc7859a255e120ddabde440dcdd76a04d35c8
Contêiner do Selenium Node Chrome do Paciente 1 criado com sucesso.
Storing .pabotsuitenames file
2024-01-23 09:37:29.940971 [PID:18884] [0] [ID:0] EXECUTING Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1
2024-01-23 09:37:46.443526 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 15.0 seconds
2024-01-23 09:38:08.348766 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 35.0 seconds
2024-01-23 09:38:35.835256 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 60.0 seconds
2024-01-23 09:39:08.785617 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 90.0 seconds
2024-01-23 09:39:47.498657 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 125.0 seconds
2024-01-23 09:40:31.730364 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 165.0 seconds
2024-01-23 09:41:21.471040 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 210.0 seconds
2024-01-23 09:42:16.848360 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 260.0 seconds
2024-01-23 09:43:17.706725 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 315.0 seconds
2024-01-23 09:44:23.085787 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 375.0 seconds
2024-01-23 09:45:34.582442 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 440.0 seconds
2024-01-23 09:46:52.266349 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 510.0 seconds
2024-01-23 09:48:15.466074 [PID:18884] [0] [ID:0] still running Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 after 585.0 seconds
2024-01-23 09:48:24.220822 [PID:18884] [0] [ID:0] PASSED Carga.Teste De Carga 1.Realizando teste de carga com paciente e médico 1 in 592.9 seconds
1 tests, 1 passed, 0 failed, 0 skipped.
===================================================
Output:  C:\Users\arauj\myproject\output.xml
Log:     C:\Users\arauj\myproject\log.html
Report:  C:\Users\arauj\myproject\report.html
Total testing: 9 minutes 52.90 seconds
Elapsed time:  10 minutes 54.92 seconds

Project Directory

MyProject
    ├─── ...
    ├───output
    └ script.py
    └ script_modified.py

script.py (previous)

...
def carga(diretorio_saida):
    subprocess.run(["pabot", "--testlevelsplit", diretorio_saida])
...

script_modified.py (new one with output folder)

the log_directory is C:\Users\arauj\myproject\output and it exist

...
def carga(diretorio_saida):
    log_directory = os.environ.get("OUTPUT", "output")
    print(f"Checking log directory: {log_directory}")

    if not os.path.exists(log_directory):
        print(f"Directory not found: {log_directory}")
        os.makedirs(log_directory)
        print(f"Directory created: {log_directory}")
    else:
        print(f"Directory found: {log_directory}")

    subprocess.run(["pabot", "--testlevelsplit", diretorio_saida, "-d", log_directory])
...

Yes. I know, this code is not clean. Reason 1) Im not a coding expert, 2) Im trying to debug this problem. :smiley:

Please… help me! :sweat_smile:

You should add the -d before the execution directory, like this:

subprocess.run(["pabot", "--testlevelsplit", "-d", log_directory, directorio_saida])
3 Likes

It worked!

Thank you very much @zastress!!!