mardi 24 mars 2015

Python - wri UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 1920: ordinal not in range(128)


I am writing a json, as string input, using python, in a .json file in the file system. However I am getting this error sometimes and I dont know why. Any ideas? The json file created is used as input in the "JSON To Features" geoprocessing tools and it fails.



# Script arguments
inputFeatures_json = arcpy.GetParameterAsText(0)
#wtite to file
jsonFileName = 'WebMap_{}.json'.format(str(uuid.uuid1()))
JSON_File = os.path.join(arcpy.env.scratchFolder, jsonFileName)
f = open(JSON_File , 'w')
f.write(inputFeatures_json)




Aucun commentaire:

Enregistrer un commentaire