Using exec() to deal with python node ports

On 28/02/2017 at 04:36, xxxxxxxx wrote:

I made this bit of code to see if I could easily address loads of ports from a python node in xpresso.
It seems to work perfectly, but I have this feeling like maybe I shouldn't be doing this.. would anyone mind having a look and letting me know?

the code:
import c4d

def main() :
    for s in xrange(9) :
        out = int(s+Input1)    
        print out
        parse = "global Output"+str(s+1)+";"
        parse2 = "Output"+str(s+1)+" = "+str(out)

On 01/03/2017 at 02:20, xxxxxxxx wrote:


We can't recommend using exec() inside a Python XPresso node.
That's not safe and could crash Cinema, depending on the code you pass to exec().