# Error csv files in UFRM model

**URL:** <https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914>\
**Category:** Software Support\
**Tags:** urban-flood\
**Created:** [March 27, 2025, 9:37am UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914 "2025-03-27T09:37:26Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Diego\_Guarin](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@Diego\_Guarin](https://community.naturalcapitalalliance.org/u/Diego_Guarin)\
**Post date:** [March 27, 2025, 9:37am UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/1 "2025-03-27T09:37:26Z")

</div>

Dear InVEST Team

I am currently working with the UFRM model, but when running the model, this error appears in the logfile: _TypeError: int() argument must be a string, a bytes-like object or a real number, not ‘NoneType’_ it seems to be that this error is located in the damage table csv file

I ran the model with the damage table files like: **CSV hyphen separated** , **CSV UTF 8 hyphen separated** and also **CSV MS DOS** but it did not work with none of them; I debugged the files also looked for empty values or cells using pandas, GDAL, OSGeoshell4W, but it seems that the csv file is ok.

Then, maybe the error could be found in other input for the model.

I would like to ask you kindly if could you review the attached files: **logfile** and **input\_folder\_2025** and you could tell me where ist he error and how could it be fixed, that would be great. The damage table is included in the attached folder.

Thanks so much and have a nice day

Best,

Diego

[InVEST-natcap.invest.urban\_flood\_risk\_mitigation-log-2025-03-27–09\_45\_47.txt](https://community.naturalcapitalalliance.org/uploads/short-url/g4cLseSvpPTt60mS5Bu5bmn38cj.txt) (2.6 KB)

[Input\_folder\_2025](https://drive.google.com/drive/folders/1ox-1Jts_bNEoxur9E-Dx5u8suKopxe0j?usp=sharing)

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [March 27, 2025, 2:26pm UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/2 "2025-03-27T14:26:19Z")

</div>

Hi @Diego_Guarin -

Thanks for posting the log file and data, I’ve asked for access to the Gfolder. Meanwhile, have you tried [saving your CSV with comma separators](https://storage.googleapis.com/releases.naturalcapitalproject.org/invest-userguide/latest/en/input_types.html#csv) instead of hyphens? See if that helps.

~ Stacie

---

<div class="post-metadata">

**Author:** ![Diego\_Guarin](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@Diego\_Guarin](https://community.naturalcapitalalliance.org/u/Diego_Guarin)\
**Post date:** [March 28, 2025, 9:58am UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/3 "2025-03-28T09:58:46Z")

</div>

Hi Stacie,

Yes also with commas but the error still appears, oh and I forgot to comment that I am using InVEST version 3.13.0, because it has worked well before in other models, but I do not know if that also has to do with the problem.

Best,

Diego

---

<div class="post-metadata">

**Author:** ![swolny](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/swolny/32/181_2.png) [@swolny](https://community.naturalcapitalalliance.org/u/swolny)\
**Post date:** [April 2, 2025, 3:09pm UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/4 "2025-04-02T15:09:11Z")

</div>

Hi Diego -

It looks like the error you’re posting about is caused by some of your built infrastructure polygons not having a value for the “type” field. When I set these blank values to “1”, this error went away.

But, then I got a different error, shown in this log file:  
[InVEST-natcap.invest.urban\_flood\_risk\_mitigation-log-2025-04-02–07\_22\_20.txt](https://community.naturalcapitalalliance.org/uploads/short-url/tjyyp9t8H6aqllAzqf4W5GghpOg.txt) (13.6 KB)

```auto
04/02/2025 07:29:34 taskgraph.Task ERROR Something went wrong when adding task reproject built infrastructure to target SRS (11), terminating taskgraph...
"File "pygeoprocessing\geoprocessing.py", line 2279, in reproject_vector
  File "osgeo\ogr.py", line 3239, in SetField
RuntimeError: not a string or os.PathLike"

```

I thought it might be because one of the fields in the built infrastructure shapefile began with “@”, or other field values have characters that might be causing the problem. So I deleted those fields, but none of that has helped. I’ve asked the software team to help, and we’ll report back here.

~ Stacie

---

<div class="post-metadata">

**Author:** ![megannissel](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.naturalcapitalalliance.org/megannissel/32/3547_2.png) [@megannissel](https://community.naturalcapitalalliance.org/u/megannissel)\
**Post date:** [April 2, 2025, 4:38pm UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/5 "2025-04-02T16:38:54Z")

</div>

Hi Diego,

Following on from Stacie’s reply, it seems the additional error ( `RuntimeError: not a string or os.PathLike`) is being caused by non-UTF-8 characters in values within the `built_infrastructure_vector_path` shapefile. We have an [open issue](https://github.com/natcap/pygeoprocessing/issues/418) to address this in Pygeoprocessing, but in the meantime you can work around the error by manually editing those values to remove non-UTF-8 characters.

I’ve attached an edited version of the vector that does run, as an example, but please note that values have been edited by both Stacie and myself. You may want to make your own edits to your original vector to ensure all changes make sense.

[built\_infrastructure\_vector\_path\_vector.zip](https://community.naturalcapitalalliance.org/uploads/short-url/rb5XCL29hBeS5sqEz76oc9Nwx6o.zip) (1.0 MB)

---

<div class="post-metadata">

**Author:** ![Diego\_Guarin](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@Diego\_Guarin](https://community.naturalcapitalalliance.org/u/Diego_Guarin)\
**Post date:** [April 3, 2025, 7:12am UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/6 "2025-04-03T07:12:11Z")

</div>

Dear Stacie

Thanks for keeping me updated and for all your help.

---

<div class="post-metadata">

**Author:** ![Diego\_Guarin](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@Diego\_Guarin](https://community.naturalcapitalalliance.org/u/Diego_Guarin)\
**Post date:** [April 3, 2025, 7:23am UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/7 "2025-04-03T07:23:09Z")

</div>

> [@megannissel](#):
>
> Following on from Stacie’s reply, it seems the additional error ( `RuntimeError: not a string or os.PathLike`) is being caused by non-UTF-8 characters in values within the `built_infrastructure_vector_path` shapefile. We have an [open issue](https://github.com/natcap/pygeoprocessing/issues/418) to address this in Pygeoprocessing, but in the meantime you can work around the error by manually editing those values to remove non-UTF-8 characters.
> 
> I’ve attached an edited version of the vector that does run, as an example, but please note that values have been edited by both Stacie and myself. You may want to make your own edits to your original vector to ensure all changes make sense.

Dear Megan.

Thank you very much for reviewing and editing the data. I will check what you sent me and let you know if it works. Thanks so much and have a nice day.

---

<div class="post-metadata">

**Author:** ![Diego\_Guarin](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@Diego\_Guarin](https://community.naturalcapitalalliance.org/u/Diego_Guarin)\
**Post date:** [April 25, 2025, 10:42am UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/8 "2025-04-25T10:42:43Z")

</div>

Dear Stacie and Megan

Thanks so much, now the model is working, thanks so much for your review 🙂

Best,

Diego

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex031/uploads/naturalcapitalproject/original/2X/8/8d95591aa074da87ea0fdd61ca47c1c3c0588aa7.png) [@system](https://community.naturalcapitalalliance.org/u/system)\
**Post date:** [May 2, 2025, 10:43am UTC](https://community.naturalcapitalalliance.org/t/error-csv-files-in-ufrm-model/5914/9 "2025-05-02T10:43:17Z")

</div>

Closed on May 2, 2025, 10:43am UTC

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