I’m trying to import the random module into python and the node throws and exception. Any ideas?
I’ve tried
import random
and
import sys
pyt_path = r'C:\Program Files (x86)\\IronPython 2.7\Lib'
sys.path.append(pyt_path)
to no avail. The IronPython console has no issue with import random
and works as expected
You would first have to define a path to IronPython’s librar, append it to the system path and then finally import the module.
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)
import random
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
#Assign your output to the OUT variable.
OUT = random.random()
Works as expected:
5 Likes
This works for me: (Edit: to late)
import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import random
OUT = random.randint(0,9)
1 Like
Thanks guys. Thought it was going to be something simple I was overlooking!