Error with export CSV

(The Mnk) #1

Error when exporting CSV

Hello, when exporting in CSV I get this:


A comma is missing here:

0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0,-1,0 <-------------

It should look like this:


(Thorbjørn Lindeijer) #2

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

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.

(The Mnk) #3

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;


sbyte animManzanasMenuInicial1 [7][21] =


(Thorbjørn Lindeijer) #4

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, 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). So if you’re on Windows, make sure you’re using the 32-bit version.

(The Mnk) #5

I have pasted the code that is in:
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

File py in python directory

Sin título-1

Extensions format in export

Sin título-2

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

In tiled directory

(Thorbjørn Lindeijer) #6

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).

(The Mnk) #7

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:

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

Thanks for all :slight_smile:

(Thorbjørn Lindeijer) #8

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

Nice to hear you got it to work!