I am finding an issue with iron python libraries while passing a boolean value
Say I have python code "booltest.py" like below.
if ip_bool is not True and ip_bool is not False :
print "invalid ip_bool"
And when I call it using Iron Python libraries
ScriptEngine engine = Python.CreateEngine();
ScriptScope scope = engine.CreateScope();
scope.SetVariable("ip_bool", false);
scope = engine.ExecuteFile("booltest.py", scope);
this results in printing 'invalid ip_bool' though its value is set to false
Further I updated "booltest.py" to test type and print more info
print "Before conversion"
print "class :" + ip_bool.
class.
name
print "value " + str(ip_bool)
print "ip_bool is not True # " + str(ip_bool is not True)
print "ip_bool is not False # " + str(ip_bool is not False)
ip_bool1 = bool(ip_bool)
print "\nAfter conversion"
print "class :" + ip_bool1.
class.
name
print "value " + str(ip_bool1)
print "ip_bool is not True # " + str(ip_bool1 is not True)
print "ip_bool is not False # " + str(ip_bool1 is not False)
and it yields
Before conversion
class :bool
value False
ip_bool is not True # True
ip_bool is not False # True
After conversion
class :bool
value False
ip_bool is not True # True
ip_bool is not False # False
Thus passing a bool value from scripting libraries malfunctions