differences between python2 and python3

When Python is the interpreter, what is a good
design for the interface to the basic NEURON
concepts.

Moderator: hines

Post Reply
cstricker
Posts: 5
Joined: Thu Dec 08, 2005 10:31 pm
Location: JCSMR - ANU, Canberra, ACT, Australia
Contact:

differences between python2 and python3

Post 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.
Post Reply