setExternal2 works well on python 2.7 and above