Page 1 of 1

differences between python2 and python3

Posted: Sat Sep 09, 2017 8:41 pm
by cstricker
In creating a python bridge from one program to neuron, I ran into several issues - but here is the one that I have not been able to fix. In python 2.7 (Mac), this worked like a charm:

def setValue(inArgs):
params = inArgs.split(space)
compartmentName = params[0]
parameterName = params[1]
value = float(params[2])
if (compartmentName != default):
h(access + space + compartmentName)
section = h.cas()
section(half).__setattr__(parameterName, value) # This is the critical part...
h.pop_section()

But in python 3.6, this throws an error - and I have no clue how to fix it. The error message that I get is

section(half).__setattr__(parameterName, value)
TypeError: can't apply this __setattr__ to object object

Has anybody a clue. Thank you - and cheers Christian.