Hello,
Here is my error: TypeError: unhashable type: 'dict'
Here is the source that is used to handle such an output error:
# More Ideas...
if state == "0":
servos.add_servo = {
'Angle_0': {
{'name':'1a', 'servo_no':0, 'max_angle':0},
{'name':'1b', 'servo_no':1, 'max_angle':0},
{'name':'2c', 'servo_no':3, 'max_angle':0},
{'name':'2d', 'servo_no':4, 'max_angle':0},
{'name':'3e', 'servo_no':6, 'max_angle':0},
{'name':'3f', 'servo_no':7, 'max_angle':0},
{'name':'4g', 'servo_no':9, 'max_angle':0},
{'name':'4h', 'servo_no':10, 'max_angle':0}}}
I did find some ideas online but I do not think they are suited for my particular case and exercise.
Also…here is the file that creates the function that is used to handle the call to add_servo
.
def add_servo(self, name, servo_no, max_angle):
assert servo_no in range(0, 16)
self.servos[name] = Servo(servo_no, max_angle)
I think I know what I am doing that is incorrect and I will test it soon. If anyone sees the error that programs in python3 more than I, please do jump forward and describe to me what it is I am doing that is faulty.
I sure could use some pointers. The reason I am using a dictionary
is b/c of the changeable uses.
Seth
P.S. If anyone needs more info. b/c of my situation, please let me know. Also, I tried to make a dictionary in the global workspace before calling it in my server function application like so:
Angle_a: {
'name':'1a', 'servo_no':0, 'max_angle':0}
Angle_b: {
'name':'1b', 'servo_no':1, 'max_angle':0}
Angle_c: {
'name':'2c', 'servo_no':3, 'max_angle':0}
Angle_d: {
'name':'2d', 'servo_no':4, 'max_angle':0}
Angle_e: {
'name':'3e', 'servo_no':6, 'max_angle':0}
Angle_f: {
'name':'3f', 'servo_no':7, 'max_angle':0}
Angle_g: {
'name':'4g', 'servo_no':9, 'max_angle':0}
Angle_g: {
'name':'4h', 'servo_no':10, 'max_angle':0}
Servo_Angles = {
"Angle_a":Angle_a,
"Angle_b":Angle_b,
"Angle_c":Angle_c,
"Angle_d":Angle_d,
"Angle_e":Angle_e,
"Angle_f":Angle_f,
"Angle_g":Angle_g,
"Angle_h":Angle_h
}
That has not worked so far, i.e. as the output states: "Angle_a":Angle_a, NameError: name 'Angle_a' is not defined
. I was unaware of having to define dictionaries prior to the call before using them in source code. I will try that too.