Cant import random module to Python


I’m trying to import the random module into python and the node throws and exception. Any ideas?

I’ve tried

import random


    import sys
    pyt_path = r'C:\Program Files (x86)\\IronPython 2.7\Lib'

to no avail. The IronPython console has no issue with import random and works as expected

Importing python modules into iron python

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'
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:

Python Nodes Basics

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)


Thanks guys. Thought it was going to be something simple I was overlooking!


This works for me too: