# Perspective CSV File Upload Not Matching CSV File

**URL:** <https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974>\
**Category:** Ignition\
**Tags:** python, vision, perspective\
**Created:** [June 13, 2023, 6:55pm UTC](https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974 "2023-06-13T18:55:20Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [June 13, 2023, 7:01pm UTC](https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974/2 "2023-06-13T19:01:04Z")

</div>

`event.file.getBytes()` is returning, as the name implies, the byte array (binary) contents of the file.  
To decode it as text, you need to assume a character encoding, such as UTF-8. You need to make a string-like, file-like object for Python's `csv` module, which you can do with the StringIO module:

> [@Perspective onFileReceived - CSV](https://forum.inductiveautomation.com/t/perspective-onfilereceived-csv/39893/2):
>
> If you want to use Python’s built-in csv module, you need to construct a file-like object to pass to the reader. Luckily, Python also predicted the idea of interpreting a string in memory as a ‘file-like’ object, so the StringIO module already exists. What you want is probably something like this: from StringIO import StringIO fileContents = event.file.getString("UTF-8") reader = csv.DictReader(StringIO(fileContents)) for row in reader: print row

---

_[View the full topic](https://forum.inductiveautomation.com/t/perspective-csv-file-upload-not-matching-csv-file/74974)._
