get_as_text() - Condition ' !f ' is true. returned: String() when reading JSON for an exported project in GOdot3

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

Hello everyone.
I created a mock up of a chess-based game. The game reads the definition of all the pieces from a JSON at the start of the game.

It works all just fine when I am in Godot, but when I export the game (I tried export in HTML5 and MACOsX), it seems it cannot read the JSON and gives me the following errors:

**ERROR**: Condition ' !f ' is true. returned: String()
**ERROR**:    At: core/bind/core_bind.cpp:1597:get_as_text() - Condition ' !f ' is true. returned: String()
**ERROR**: **SCRIPT ERROR**: Invalid call. Nonexistent function 'keys' in base 'Nil'.
**ERROR**:    At: res://scenes/Model.gdc:40:_ready() - Invalid call. Nonexistent function 'keys' in base 'Nil'.
**ERROR**: **SCRIPT ERROR**: Invalid get index 'pos_in_the_grid' (on base: 'Nil').
**ERROR**:    At: res://scenes/World.gdc:44:_ready() - Invalid get index 'pos_in_the_grid' (on base: 'Nil').

you can see the error here: WIP : Summon or move by notapixelstudio
I left the debug option in order to see the errors.

The code is here

I can’t wrap my head around this. Please can anyone help?

P.S.: The resource of the JSON is correctly exported, you can find the structure of the project and the files in the download section.

:bust_in_silhouette: Reply From: volzhs

Fill the field for exporting non-resource files at Export > Resources

And there was a custom (tiled) importer which makes json handled as resource.
so, need to make not to handle it by renaming extension, like .json_data

I did… And you can see the file in the that can be downloaded from the link

salvob | 2018-05-01 13:37

there is board.json.import file not board.json in the zip file.
with my quick test, exporting project with json file,
the file name is not changed in exported zip file.
why is your json file renamed to json.import?

volzhs | 2018-05-01 13:44

That should be the standard, no? All the assets are renamed with .import .Can you reproduce with the source files, from the github?

salvob | 2018-05-01 13:50

the resources those can be imported to editor like .png, .obj, .dae, .ogg, .csv(translation) will be renamed, but not .json I think.
and I can’t extract the zip file you attached on github.

volzhs | 2018-05-01 15:12

Really? It’s a zip…
Try with the github repo if you can and want :slight_smile: and thanks for your time

salvob | 2018-05-01 15:36

oh, i never thought about your github repo.
will try it later.

volzhs | 2018-05-01 15:38

I just saw your repo, and I found importer="vnen.tiled_importer" in .json.import
I guess it’s not about tiled, but the custom importer handle this as resource.
so after all, it’s renamed and moved .import
if you need that custom importer for your project,
try different extension name for your data like piece_def.json_data

volzhs | 2018-05-01 15:43

Your trick did work! But it is weird that the plugin has the power to hide all the json from the export.
Mmmm I will open an issue in the github of the tiled_importer.

If you edit your answer with this trick, I will solve this question.
Thank you Volzhs

salvob | 2018-05-01 20:45

added about importer problem to answer. :slight_smile:

volzhs | 2018-05-01 22:03

I ran into this same issue. Could you point me to the issue filed for the importer? This would not have been easy to have figured out what was going on on my own, and I would like to make sure that issue gets attention.

shianiawhite | 2019-04-14 03:37