Closed petrushy closed 9 years ago
Good catch @petrushy. Fix and a new minor version bump have been committed that includes a more explicit write()
method, and I tested both the updated write and new read examples in the README in interactive python for 2.7 and 3.3. Everything looks like it's working much better now.
This isn't pushed up to pypi yet; just waiting on Travis Build #53. Once that completes, assuming it passes, I'll push the new version up to pypi and resolve this issue.
Okay, all set! Version 0.3.2 with today's commits are pushed up to pypi.
great work you rock :-)
Hi I'm not getting the example in README.rst to work, using python 2.7.
Added an import of json, and changed to capitals on doc = czml.CZML() and moved bb.show = True from initialization to script.
Import the library
from czml import czml import json
Initialize a document
doc = czml.CZML()
Create and append the document packet
packet1 = czml.CZMLPacket(id='document',version='1.0') doc.packets.append(packet1)
Create and append a billboard packet
packet2 = czml.CZMLPacket(id='billboard') bb = czml.Billboard(scale=0.7) #, show=True bb.show = True bb.image = 'http://localhost/img.png' bb.color = {'rgba': [0, 255, 127, 55]} packet2.billboard = bb doc.packets.append(packet2)
Write the CZML document to a file
filename = "example.czml" with open(filename, 'w') as file: json.dump(doc.data(), file)
I however get an error on last line: 182 183 """ --> 184 raise TypeError(repr(o) + " is not JSON serializable") 185 186 def encode(self, o):
TypeError: <generator object data at 0x0000000004792CA8> is not JSON serializable