Q:

Python object appears as map (dict) but can't call by attribute or __getitem__?

I have an object myobj (an instance of MyObj) in python which, when called with print(), prints
{"host": "localhost", "user_indices": [], "password": null, "port": 27017}

So myobj appears to be a dictionary-style object. But myobj['host'] raises 
TypeError: 'AutoProxy[MyObj]' object has no attribute '__getitem__'

And I get an AttributeError when trying myobj.host.
I've also tried using myobj.__dict__['host'] and dict(myobj)['host'] to no avail. Has anyone encountered this problem before?

A:

First of all, there is no such thing as "null" in python. You should use "None" instead. When you are using null the code should raise a NameError.
Second, try this code, maybe just switching the null to None should fix the problem:
>>> temp = {"host": "localhost", "user_indices": [], "password": None, "port": 27017}
>>> temp['host']
'localhost'
>>> 

