Multiple errors when the path contains spaces

Asked by Jean-Loup Tastet

This is more of a bug report than an actual question.

Summary: If the path to the directory in which MadGraph is *run* contains spaces, a number of errors occur, which seem to be caused by unquoted paths.

Version: 2.7.2, 2.7.3 (development)

Environment: Linux, bash 5.0.11, Python 2.7.18

Steps to reproduce:
1. $ export MG=/path/to/mg/source/directory
2. $ mkdir "/tmp/Folder with spaces"
3. $ cd "/tmp/Folder with spaces"
4. $ python2 "$MG"/bin/mg5_aMC
5. MG5_aMC>generate p p > mu+ mu-
6. MG5_aMC>output Test
7. MG5_aMC>launch Test
8. >done
9. >2
10. >done

Observed behaviour:

* When entering `2` at step 9. to edit run_card.dat, I get the following error:

    open /tmp/Folder with spaces/Test/Cards/run_card.dat
    syntax: open FILE
    -- open a file with the appropriate editor.
       If FILE belongs to index.html, param_card.dat, run_card.dat
       the path to the last created/used directory is used
       The program used to open those files can be chosen in the
       configuration file ./input/mg5_configuration.txt
    OPEN command requires exactly one argument
    not valid argument. Valid argument are file path or value in (0,done,1,param,2,run).

  This seems to be caused by not quoting the path given to `open`. Running instead `open "/tmp/Folder with spaces/Test/Cards/run_card.dat"` works as expected.

* Once the run starts, I get a number of `chmod: cannot access 'spaces/Test/SubProcesses/P1_qq_ll/ajob13': No such file or directory`, `WARNING: [Errno 13] Permission denied`, as well as `UnboundLocalError: local variable 'pid' referenced before assignment`. It seems that relevant error is the first one, and is caused by the path given to `chmod` not being quoted either.

This bug is definitely not a show stopper (easy to work around by running MG from a path without spaces), but an easy fix is probably just to add quotes ("") around all paths in the relevant shell scripts.

Cheers,
Jean-Loup

Question information

Language:
English Edit question
Status:
Solved
For:
MadGraph5_aMC@NLO Edit question
Assignee:
No assignee Edit question
Solved by:
Jean-Loup Tastet
Solved:
Last query:
Last reply:
Revision history for this message
Olivier Mattelaer (olivier-mattelaer) said :
#1

Hi,

They are indeed many issues that pops up with space in the path.
We have detection raising a warning if MG5aMC is installed on such path, but did not think to put such warning for output code.
Having the full code running in that scenario will required too much time/effort.

replacing open /tmp/Folder with spaces/Test/Cards/run_card.dat
by
open "/tmp/Folder with spaces/Test/Cards/run_card.dat"
will actually lead to the same error (that command is not innterpreted by your shell but by python)

So the best is probably to add some warning to let the user knows about that issue.

Thanks,

Olivier

Revision history for this message
Jean-Loup Tastet (jltastet) said :
#2

Hi Olivier,

Thanks for your answer! Indeed this is a minor issue, and it can easily be worked around. I just wanted to make sure that it was reported.

Cheers,
Jean-Loup