# Passing a custom flag to pvbatch

**URL:** https://discourse.paraview.org/t/passing-a-custom-flag-to-pvbatch/8616
**Category:** ParaView Support
**Created:** [December 13, 2021, 4:53pm UTC](https://discourse.paraview.org/t/passing-a-custom-flag-to-pvbatch/8616 "2021-12-13T16:53:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Yasushi\_Saito](https://discourse.paraview.org/user_avatar/discourse.paraview.org/yasushi_saito/32/3469_2.png) [@Yasushi\_Saito](https://discourse.paraview.org/u/Yasushi_Saito)
#### Post date: [December 13, 2021, 4:53pm UTC](https://discourse.paraview.org/t/passing-a-custom-flag-to-pvbatch/8616/1 "2021-12-13T16:53:19Z")

</div>

With paraview 5.10,

`pvbatch --displays=0 my-script --my-flag=xxx`

fails with `unknown option --my-flag=xxx`. I also tried

`pvbatch --displays=0 my-script -- -my-flag=xxx`

and I get the same error. This worked with paraview 5.9. Is there a way to pass an arg starting with “–” to the script?

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 13, 2021, 4:57pm UTC](https://discourse.paraview.org/t/passing-a-custom-flag-to-pvbatch/8616/2 "2021-12-13T16:57:21Z")

</div>

```auto
> cat /tmp/foo.py
import sys
print("Args: ", sys.argv)

```

```bash
./bin/pvbatch -- /tmp/foo.py foo
Args: ['/tmp/foo.py', 'foo']

```

---

<div class="post-metadata">

### Author: ![Yasushi\_Saito](https://discourse.paraview.org/user_avatar/discourse.paraview.org/yasushi_saito/32/3469_2.png) [@Yasushi\_Saito](https://discourse.paraview.org/u/Yasushi_Saito)
#### Post date: [December 13, 2021, 5:09pm UTC](https://discourse.paraview.org/t/passing-a-custom-flag-to-pvbatch/8616/3 "2021-12-13T17:09:30Z")

</div>

Thanks, it looks like flag `--display` is acting strangely.

`pvbatch --mpi /tmp/foo.py --foo`

works as expected

`pvbatch --displays=0 /tmp/foo.py --foo`

fails with `unknown option --foo`.

`pvbatch --displays 0 /tmp/foo.py --foo`

fails in the same way.

`pvbatch --displays=0 /tmp/foo.py`

fails with

`( 0.122s) [pvbatch] pvpython.h:95 ERR| No script specified. Please specify a batch script or use 'pvpython'.`

---

<div class="post-metadata">

### Author: ![utkarsh.ayachit](https://discourse.paraview.org/user_avatar/discourse.paraview.org/utkarsh.ayachit/32/39_2.png) [@utkarsh.ayachit](https://discourse.paraview.org/u/utkarsh.ayachit)
#### Post date: [December 13, 2021, 6:38pm UTC](https://discourse.paraview.org/t/passing-a-custom-flag-to-pvbatch/8616/4 "2021-12-13T18:38:45Z")

</div>

> [@Yasushi\_Saito](#):
>
> `pvbatch --displays=0 /tmp/foo.py --foo`

Try this instead:

```auto
pvbatch --displays=0 -- /tmp/foo.py --foo

```

Note the `--` separator added just before the Python script is specified. That helps break which command line args are processed by ParaView and which ones are passed on to the Python interpreter.

---

<div class="post-metadata">

### Author: ![Yasushi\_Saito](https://discourse.paraview.org/user_avatar/discourse.paraview.org/yasushi_saito/32/3469_2.png) [@Yasushi\_Saito](https://discourse.paraview.org/u/Yasushi_Saito)
#### Post date: [December 13, 2021, 7:14pm UTC](https://discourse.paraview.org/t/passing-a-custom-flag-to-pvbatch/8616/5 "2021-12-13T19:14:29Z")

</div>

Thanks. That worked.
