+2 votes

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!

in Engine by (23 points)

1 Answer

+1 vote
Best answer

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


by (1,869 points)
selected by

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.