i have funny error and i dont understand why. i trying to import in loop couple of files and enter to json, when i do it in for loop its not work and when i write the file name its work. its give me error
'utf-8' codec can't decode byte 0x80 in position 3131: invalid start byte
not work:
for fileName in os.listdir("files/greenhouses"):
with open("files/greenhouses/"+fileName, "rt") as f:
jsonFile = json.load(f)
plantingPoints = [PlantingPoint(details["DATE"], details["NAME"], details["OCCUPIED"]) for details in jsonFile[1:]]
greenhouse = Greenhouse(jsonFile[0]["TEMPERATURE"], plantingPoints)
work:
for fileName in os.listdir("files/greenhouses"):
with open("files/greenhouses/1.json", "rt") as f:
jsonFile = json.load(f)
plantingPoints = [PlantingPoint(details["DATE"], details["NAME"], details["OCCUPIED"]) for details in jsonFile[1:]]
greenhouse = Greenhouse(jsonFile[0]["TEMPERATURE"], plantingPoints)
what i can doo ?? i tried a lot of solutions that i found buy nothing work the json contain simple dictinary