[Python] sbatch does not find path to tcsh-file when python subprocess.call is executed

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

  1. Stack

    Stack Membro Participativo

    I have a python script (startup.py) that executes a tcsh-script (test.sh) via python subprocess.call(test.sh, shell=True). Everything works fine as long as I directly execute the python-script in my home directory on the cluster. It does not work, when I execute the same script using sbatch.

    Path for the python-script is: /home/myname/anaconda/pro/myPy/startup.py shown below:

    mycomp='/home/myname/'

    import compileall
    compileall.compile_dir(mycomp+'anaconda/pro/myPy/', force=1)

    import subprocess as subs
    subs.call(mycomp+'anaconda/pro/myRun/test.sh', shell=True)


    Path for the tcsh-script (#!/bin/tcsh) is: /home/myname/anaconda/pro/myRun/test.sh Note: I use tcsh in this case!

    my slurm script /home/myname/config.sh, version is slurm 0.4.3:

    #!/bin/sh

    #SBATCH -A 16cores
    #SBATCH --ntasks=1
    #SBATCH --cpus-per-task=16
    #SBATCH --job-name=300
    #SBATCH --error=300.err
    #SBATCH --output=300.out
    #SBATCH --partition=all
    #SBATCH --time=60-00:00:00

    export OMP_NUM_THREADS=16

    ### Switch to the working directory;
    cd ~/anaconda/pro/myPy/

    ### Run:
    python startup.py


    I execute it as: myname@mycluster:~$ sbatch config.sh

    Error message in 300.err

    /bin/sh: 1: /home/myname/anaconda/pro/myRun/test.sh: not found


    The file status is:

    -rwxr-xr-x 1 myname myname 80891 abr 4 18:32 test.sh


    What do I miss here?

    Continue reading...

Compartilhe esta Página