Hello,
Does anybody generate his own ID? with python generator?
f.e. Code: 65jU4jlkK
# Phython-Standard- und DesignScript-Bibliotheken laden
import sys
import clr
import random, string
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
# Die Eingaben für diesen Block werden in Form einer Liste in den IN-Variablen gespeichert.
ran = ''.join(random.choices(string.ascii_letters + string.digits, k=16))
OUT = ran
KR
Andreas
The reason you’re getting the error is this:
In Ironpython there is no method random.choices() only random.choice() which takes only a sequence and has only one parameter:
https://ironpython-test.readthedocs.io/en/latest/library/random.html#random.choice
Instead you can use random.sample() to get your code working
And you’r missing the ironpython path part in the input (line 3):
import clr
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import random
import string
OUT = "".join(random.sample(string.ascii_letters + string.digits, k=16))
2 Likes