# Csv file import - Error: Cannot create PyString with non-byte value

**URL:** <https://forum.inductiveautomation.com/t/csv-file-import-error-cannot-create-pystring-with-non-byte-value/47143>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [May 26, 2021, 1:16pm UTC](https://forum.inductiveautomation.com/t/csv-file-import-error-cannot-create-pystring-with-non-byte-value/47143 "2021-05-26T13:16:04Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [May 26, 2021, 4:01pm UTC](https://forum.inductiveautomation.com/t/csv-file-import-error-cannot-create-pystring-with-non-byte-value/47143/3 "2021-05-26T16:01:54Z")

</div>

I was able to get a sample file (encoded in UTF-8) containing Chinese characters to decode in `csv.DictReader` with a little finagling:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/f/9/f92f292c848be910d86eca319cdb89b9d5d1212b.png)

```python
import csv
from io import StringIO
from org.python.core.util import StringUtil

path = r"C:\Users\pgriffith\Downloads\IM Translation_Small.csv"

data = system.file.readFileAsBytes(path)
reader = csv.DictReader(StringIO(StringUtil.fromBytes(data)))

for row in reader:
	print {key: value.decode("utf-8") for key, value in row.items()}

```

---

_[View the full topic](https://forum.inductiveautomation.com/t/csv-file-import-error-cannot-create-pystring-with-non-byte-value/47143)._
