'NoneType' python error

Hello all,

I am facing a problem i can’t find a fix for :

In a Chop Execute DAT i have the following code

[code]def onOffToOn(channel, sampleIndex, val, prev):
import random
randNum = random.randint(1,27)

pathStart = '/ui1/container2/item'
pathEnd = '/trigger1'
nextClipPath = pathStart + str(randNum) + pathEnd

op('nextClipPath').par.triggerpulse.pulse()

return[/code]

I used to use a relative path in that code like op(‘…/item’) but ended up using an absolute path but the same is happening.

Python keeps throwing the error

Traceback (most recent call last): File "/ui1/container2/item27/chopexec1", line 19, in onOffToOn AttributeError: 'NoneType' object has no attribute 'par'

Any clue ?

I am using TD 099 2017.16620 on macOS Sierra

thanks a lot

trying in TScript

opparm -p nextClipPath triggerpulse (1)

another error

[code]DAT compile error: /ui1/container2/item27/chopexec1
File “/ui1/container2/item27/chopexec1”, line 18
opparm -p nextClipPath triggerpulse (1)
^
SyntaxError: invalid syntax

File “/ui1/container2/item27/chopexec1”, line 18
opparm -p nextClipPath triggerpulse (1)[/code]

In the error message you can see the operator you want to pulse does not exist (nonetype)
This is because you’re treating a variable as a string.
in the line

[code] op(‘nextClipPath’).par.triggerpulse.pulse()

[/code]
remove the quotes around nextClipPath

This is suuuuuch an obvious error i was unable to see it ! :open_mouth: :open_mouth: :open_mouth:
shame on me

thanks a lot