differences between python2 and python3

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

Moderator: hines

differences between python2 and python3

Postby cstricker » Sat Sep 09, 2017 8:41 pm

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

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.
Posts: 1
Joined: Thu Dec 08, 2005 11:31 pm
Location: JCSMR - ANU, Canberra, ACT, Australia

Return to NEURON + Python

Who is online

Users browsing this forum: Google [Bot] and 2 guests