Parsing a dictionary to a nested dictionary in a instantiated custom class from a JSON file works on windows but not my raspberry pi, anyone have any ideas of a workaround ?

Godot Version

4.5

Question

Hello Godot enjoyers. I work as a on a cannabis farm in Canada and made a little app to help with tracking our waterings and reporting using control nodes. It tracks how we fertilized the plants and how much water we use daily and saves it to a nested dictionary on a class I made, which I stringify as JSON files. I later export these as csv files. On windows the following function reliably parses my JSON files, and fills out all the nested dictionaries when the app opens.

However when I copied the project to my raspberry pi 5, it no longer does and my objects just have the empty dummy dictionary they get created with. I use a very similar function to load my fertilizer formulas, user list, and lot list without issue.
This is on the ready() of an autoload.

If anyone has an idea of a workaround or a different way to duplicate the info I’d be pretty grateful. My print out for the filepath shows as correct, and this works on my windows pc.

func _ready() → void:
load_list() #Loads an array strings that are the Dictionary keys
for i in lot_list:

  •   var new_lot = GrowLot.new()*
    
  •   new_lot.info.lot_number = i*
    
  •   var new_lot_path = "user://%s.JSON" % i*
    
  •   load_lot(new_lot_path, new_lot)*
    
  •   lot[i] = new_lot*
    
  •   print(lot_list)*
    
  •   print(lot)*
    

Hope it’s ok to bump my own post but I solved this by getting rid of the GrowLot class which was just a dictionary and a few methods, I put all its methods in the global script and modified them to take a dictionary as the argument.Then instead of referencing them through an array of the class that i created I just changed lot to lot{}

tldr: parse_string doesn’t work in a for loop to write to a custom class_name objects nested dictionary on raspberry pi, but it will on windows. However It will write to a godot dictionary so I moved the methods elsewhere and just write to a standard dictionary and all is good. Maybe it’s a linux thing or maybe it’s an arm64 thing.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.