# Python script used by bash script not found

**URL:** <https://community.seqera.io/t/python-script-used-by-bash-script-not-found/2109>\
**Category:** Ask for help\
**Tags:** nextflow\
**Created:** [May 5, 2025, 11:21am UTC](https://community.seqera.io/t/python-script-used-by-bash-script-not-found/2109 "2025-05-05T11:21:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ReaKal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/reakal/32/1794_2.png) [@ReaKal](https://community.seqera.io/u/ReaKal)\
**Post date:** [May 5, 2025, 11:21am UTC](https://community.seqera.io/t/python-script-used-by-bash-script-not-found/2109/1 "2025-05-05T11:21:38Z")

</div>

In my nextflow process named `Predict` the `predict.sh` script calls the `read_json.py` script. The issue is that the `read_json.py` file (that I have stored in `bin` and made executable) is not found. What might be the problem?  
Later, as expected, based on the instructions in the `predict.sh`, the data directory `all_models` is found empty and causes python to exit the program.

```auto
ERROR ~ Error executing process > 'Predict (1)'

Caused by:
  Process `Predict (1)` terminated with an error exit status (1)

Command executed:

  predict.sh data.json weights.ckpt
  
  cat <<-END_VERSIONS > versions.yml
      "Predict":
          python: $(python --version 2>&1 | sed 's/Python //g')
  
      END_VERSIONS

Command exit status:
  1

Command output:
  Directory all_models is empty.

Command error:
  python: can't open file 'read_json.py': [Errno 2] No such file or directory
  Directory all_models is empty.

```

---

<div class="post-metadata">

**Author:** ![Fury\_Gaming](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@Fury\_Gaming](https://community.seqera.io/u/Fury_Gaming)\
**Post date:** [May 6, 2025, 4:05am UTC](https://community.seqera.io/t/python-script-used-by-bash-script-not-found/2109/2 "2025-05-06T04:05:59Z")

</div>

Hi Rea,  
Welcome to community.  
Have you tried passing absolute path?  
If not try doing that it might work.

Fury

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [May 6, 2025, 7:42am UTC](https://community.seqera.io/t/python-script-used-by-bash-script-not-found/2109/3 "2025-05-06T07:42:32Z")

</div>

How are you calling the `read_json.py` file in the bash script?

I ask because, if it’s called like:

```bash
python read_json.py ...

```

then the script is not looking for `read_json.py` in the `PATH`. It’s looking relative to the current working directory.

For the script to be found in the `PATH`, it should also be called like:

```bash
read_json.py ...

```

---

<div class="post-metadata">

**Author:** ![ReaKal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/reakal/32/1794_2.png) [@ReaKal](https://community.seqera.io/u/ReaKal)\
**Post date:** [May 6, 2025, 11:28am UTC](https://community.seqera.io/t/python-script-used-by-bash-script-not-found/2109/4 "2025-05-06T11:28:43Z")

</div>

This works as well.

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/system/32/2402_2.png) [@system](https://community.seqera.io/u/system)\
**Post date:** [May 13, 2025, 11:29am UTC](https://community.seqera.io/t/python-script-used-by-bash-script-not-found/2109/5 "2025-05-13T11:29:11Z")

</div>

Closed on May 13, 2025, 11:29am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
