# Call pvbatch.exe from a Python script with as argument a file path containing Japanese characters

**URL:** https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721
**Category:** Development
**Tags:** python
**Created:** [January 2, 2022, 3:04am UTC](https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721 "2022-01-02T03:04:06Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![aruno14](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aruno14/32/8292_2.png) [@aruno14](https://discourse.paraview.org/u/aruno14)
#### Post date: [January 2, 2022, 3:04am UTC](https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721/1 "2022-01-02T03:04:06Z")

</div>

Hello,

I want to call `pvbatch.exe` (on Windows) to create a VTU file, since I use a GUI, I don’t want to block during the process. So, I use the below code:

```auto
args = [PARAVIEW_PATH, input_file_path]
print(args)
self.paraview_process = subprocess.Popen(args)

```

It works well with usual paths, but if the `input_file_path` contains a Japanese character, I got the below error:

```auto
['C:/Program Files/ParaView 5.9.1-Windows-Python3.8-msvc2017-64bit/bin/pvbatch.exe', 'C:\\Users\\arnaud\\Source\\Repos\\geoinfo\\src\\results\\20220102115342ワーク\\make_vtu_test_sample_temperature_20220102115342ワーク.py']
C:/Program Files/ParaView 5.9.1-Windows-Python3.8-msvc2017-64bit/bin\vtkpython: can't open file 'C:\Users\arnaud\Source\Repos\geoinfo\src\results\20220102115342���[�N\make_vtu_test_sample_temperature_20220102115342���[�N.py': [Errno 2] No such file or directory

```

I report this problem as a bug (see issue link below), but it seems to be a Windows problem.  
[https://gitlab.kitware.com/paraview/paraview/-/issues/21144](https://gitlab.kitware.com/paraview/paraview/-/issues/21144)

I use Python 3.7 and ParaView 5.9.1 or ParaView 5.10.0-RC1.

If I use below code:

```auto
args = [PARAVIEW_PATH.encode(), input_file_path.encode()]
print(args)
self.paraview_process = subprocess.Popen(args)

```

I get: `a bytes-like object is required, not 'str'`.

Does anyone know how I can solve this problem ?

Thank you

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [January 2, 2022, 10:35pm UTC](https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721/2 "2022-01-02T22:35:32Z")

</div>

It seems like there’s some mojibake going on. Everything in VTK is expected to be UTF-8. Recently, work was done to accept filepaths in some places which skips the requirement. I think this showed up in 5.10 at some point, but anything older won’t support it.

---

<div class="post-metadata">

### Author: ![todoooo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/todoooo/32/2819_2.png) [@todoooo](https://discourse.paraview.org/u/todoooo)
#### Post date: [January 2, 2022, 11:15pm UTC](https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721/3 "2022-01-02T23:15:36Z")

</div>

There is a problem with **pvpython** and **pvbatch** processing non-English characters on Windows. I’m testing a fix for this.

What recent changes to VTK skip the requirement for utf-8 encoded file paths?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [January 3, 2022, 3:31pm UTC](https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721/4 "2022-01-03T15:31:56Z")

</div>

> [@todoooo](#):
>
> What recent changes to VTK skip the requirement for utf-8 encoded file paths?

[https://gitlab.kitware.com/vtk/vtk/-/merge\_requests/8290](https://gitlab.kitware.com/vtk/vtk/-/merge_requests/8290)

---

<div class="post-metadata">

### Author: ![todoooo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/todoooo/32/2819_2.png) [@todoooo](https://discourse.paraview.org/u/todoooo)
#### Post date: [January 3, 2022, 11:15pm UTC](https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721/5 "2022-01-03T23:15:34Z")

</div>

I can’t see where **VTK\_FILEPATH** is defined, so I don’t see how it changes the utf-8 file name requirement.

I have discovered that 5 people have introduced changes to VTK over the past year for opening files and streams which are not unicode compliant. It is annoying that 3 of those people are Kitware staff!

---

<div class="post-metadata">

### Author: ![todoooo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/todoooo/32/2819_2.png) [@todoooo](https://discourse.paraview.org/u/todoooo)
#### Post date: [April 13, 2022, 9:02pm UTC](https://discourse.paraview.org/t/call-pvbatch-exe-from-a-python-script-with-as-argument-a-file-path-containing-japanese-characters/8721/6 "2022-04-13T21:02:58Z")

</div>

This has been fixed now.
