"'Nonetype' error is unscriptable" error on dictionary

I'm trying to assist in a map question and I've broken my code.

	for car in value:
		protoMarker = recursiveCopy(self.custom.sampleMarker)
#		return car['latitude']
		lat = car['latitude']
  • The recursive copy is working. I can return the dictionary.
  • return car['latitude'] results in 42.472783.
  • lat = car['latitude'] results in an error: "'Nonetype' error is unscriptable."
  • return type(lat) reports "class.org.phthon.core.PyFloat".

Any ideas?

The successful return just means that your first entry has latitude but some following entry does not. Look for typos?

Thanks, Phil, but it's weirder than that.

Nonetype 1

Nonetype 2

Like Phil said.
One of your records doesn't have a valid float for latitude.
Your first code example exits the for and the transform with the return car['latitude']
The second one, goes through the dictionary and hits an entry without a valid latitude.

1 Like

Doh!
Thanks!

Instead returning the first latitute, use system.perspective.print to show all of them.

1 Like