Thanks for the quick response and the correction on the interactive python prompt.... still... not being a python guy here, I'm unable to run that. See my output below....
... d.checkRelations(repair=True)
... d.os.buildRelations()
... d.os.checkRelations(repair=True)
... print "%s has %s components" % (d.id, len(d.getDeviceComponents()))
... d = find('mydevice')
File "<console>", line 23
d = find('mydevice')
^
SyntaxError: invalid syntax
>>> fixPOSKeyError(d)
Traceback (most recent call last):
File "<console>", line 1, in <module>
NameError: name 'fixPOSKeyError' is not defined
>>>
>>>
>>>
>>>
The first 4 lines are the last part of the cut and paste of your code. Notice how it's prompt is ...
When I then run the d = find('yourdevicename') command right after that's where the syntax error happens and then it returns to the >>> prompt.
So what happens is....
1. I enter zendmd and am presented with the >>> prompt
2. I enter the first line of your function def fixPOSKeyError(d): and them presented with the ... prompt
3. I enter the code to the function and when complete am still at the ... prompt.
4. At the ... prompt I enter d = find('mydevice') and get a syntax error.
After entering your function and ending at the ... prompt, how do I get back to >>> prompt to run the
def fixPOSKeyError(d): command? End? Quit? Close?
I hope the makes sense and I apologize for the ignorance. Just looking for a fix to this error and yours seems to be right on track.