# Error with export CSV

**URL:** <https://discourse.mapeditor.org/t/error-with-export-csv/2882>\
**Category:** Bugs\
**Created:** [December 12, 2017, 7:33pm UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882 "2017-12-12T19:33:05Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Mnk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/the_mnk/32/2274_2.png) [@The\_Mnk](https://discourse.mapeditor.org/u/The_Mnk)\
**Post date:** [December 12, 2017, 7:33pm UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/1 "2017-12-12T19:33:05Z")

</div>

Error when exporting CSV

Hello, when exporting in CSV I get this:

0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0  
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

A comma is missing here:

0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0 \<-------------  
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

It should look like this:

0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,  
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [December 12, 2017, 7:57pm UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/2 "2017-12-12T19:57:03Z")

</div>

> [@The\_Mnk](#):
>
> Hello, when exporting in CSV I get this:
> 
> 0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0  
> -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

That is strange, because the CSV plugin doesn’t put a semicolon at the end.

> [@The\_Mnk](#):
>
> A comma is missing here:
> 
> 0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0 \<-------------  
> -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1;

CSV files generally do not have a comma at the end of each line. Why do you think it should be there? I would suggest you adapt your loading code such that you don’t need that comma.

---

<div class="post-metadata">

**Author:** ![The\_Mnk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/the_mnk/32/2274_2.png) [@The\_Mnk](https://discourse.mapeditor.org/u/The_Mnk)\
**Post date:** [December 12, 2017, 9:16pm UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/3 "2017-12-12T21:16:33Z")

</div>

But in the language I use to make video games, the values must be separated by a comma, otherwise the compiler gives an error.

program test;

private

```
sbyte animManzanasMenuInicial1 [7][21] =
0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0;

```

begin  
…  
…

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [December 13, 2017, 9:00am UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/4 "2017-12-13T09:00:11Z")

</div>

> [@The\_Mnk](#):
>
> But in the language I use to make video games, the values must be separated by a comma, otherwise the compiler gives an error.

Right, so you can’t copy/paste the CSV file into your code. You would either need to write your own plugin that outputs in the format you need, or write a bit of code that reads and parses the CSV file.

You know what, since documenting the Python plugin was anyway a long-overdue task, I’ve [written a page about it now](http://doc.mapeditor.org/en/latest/manual/python/), featuring an example that writes a map in your desired format.

Just note that the Python plugin currently doesn’t ship with the 64-bit version of Tiled for Windows ([#1762](https://github.com/bjorn/tiled/issues/1762)). So if you’re on Windows, make sure you’re using the 32-bit version.

---

<div class="post-metadata">

**Author:** ![The\_Mnk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/the_mnk/32/2274_2.png) [@The\_Mnk](https://discourse.mapeditor.org/u/The_Mnk)\
**Post date:** [December 13, 2017, 10:29am UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/5 "2017-12-13T10:29:17Z")

</div>

Hello  
I have pasted the code that is in:  
[http://doc.mapeditor.org/en/latest/manual/python/](http://doc.mapeditor.org/en/latest/manual/python/)  
In a .txt file and then I saved it with .py extension  
When I give to export, the option “Example” does not appear.

What am I doing wrong?

I Have python 3.6 and 2.7

Code in txt file

![Sin título](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/mapeditor/original/2X/1/13cb24629772403576940a45e33b82c436c7fc91.png)

File py in python directory

![Sin título-1](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/mapeditor/original/2X/f/f4f419edec59f3eaa3a17cd00c0a5e256c765d35.png)

Extensions format in export

![Sin título-2](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/mapeditor/original/2X/6/6988bf4ba35f5d3a2932ae48a8a414f76de59762.png)

I have also placed it in the Tiled directory but it did not work either

![Sin título](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/mapeditor/original/2X/3/39025f89c015500d39d334100e0f27f0d2a75ab8.png)

In tiled directory

![Sin título-1](https://cdck-file-uploads-canada1.s3.dualstack.ca-central-1.amazonaws.com/flex035/uploads/mapeditor/original/2X/7/7147237f9aa82b02aac530cf1f280c7d61c54da4.png)

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [December 13, 2017, 11:45am UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/6 "2017-12-13T11:45:03Z")

</div>

The problem is that you didn’t put the script in the right location. In the documentation I wrote that you need to put the scripts in the `~/.tiled` folder.

The `~` means your home directory. I can never remember where this is on Windows, but you could try to open a Command Prompt (Win+R, `cmd`) and type `echo %HOME%` to find out. Also note that the directory is required to have that dot at the start (on Linux and macOS, these are hidden folders).

---

<div class="post-metadata">

**Author:** ![The\_Mnk](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/the_mnk/32/2274_2.png) [@The\_Mnk](https://discourse.mapeditor.org/u/The_Mnk)\
**Post date:** [December 13, 2017, 12:10pm UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/7 "2017-12-13T12:10:33Z")

</div>

Ok I have it

As a note to add, to create the name of the folder in windows it is necessary to do it like this:  
.tile.

If you do it like that  
.tiled  
Windows will not let you so you must add another point at the end to get  
.tiled

Thanks for all 🙂

---

<div class="post-metadata">

**Author:** ![bjorn](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.mapeditor.org/bjorn/32/1599_2.png) [@bjorn](https://discourse.mapeditor.org/u/bjorn)\
**Post date:** [December 13, 2017, 12:26pm UTC](https://discourse.mapeditor.org/t/error-with-export-csv/2882/8 "2017-12-13T12:26:59Z")

</div>

I should probably change the folder on Windows or make it configurable…

Nice to hear you got it to work!
