Exporting game with external resources (.csv file)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By raksom

I just started taking a look at how my game acts when exported, and noticed that a .csv file doesn’t seem to want to be exported alongside my other assets.

Here is how I use it in code:

var fr := File.new()
fr.open("res://external_resources/world-cities.csv", fr.READ)

while !fr.eof_reached():
	var csv = fr.get_csv_line()

In export_presets.cfg I have tried specifying both


as well as


but both seem to fail to include the world-cities.csv file.

When running the exported executable in debug mode I get the following two errors

ERROR: File must be opened before use.
At: core/bind/core_bind.cpp:1956
ERROR: File must be opened before use.
At: core/bind/core_bind.cpp:2058

as well as a script error following failing to open the file.

Opening the exported .pck in a text editor and searching for the file shows it under a [deps] section, but I don’t know if that means it has been included or is just used within the project.

Any help or pointers in the right direction would be appreciated!

:bust_in_silhouette: Reply From: rakkarage

maybe try it as a txt (or even res) file

I wasn’t able to import a .txt file (for whatever reason it wouldnt show in godot’s file hierarchy), but it seems to work fine as a .tres. Very strange, I will open another issue for it. Cheers!


Actually, while godot seem to be able to parse it as a .tres as expected, the editor also throws some errors.Keeping it as a .txt even though godot doesn’t want to recognize it’s existance works fine however.

raksom | 2020-05-22 09:27