my first time trying Python, but as usually tying to get knowledge of it.
i wonder if anyone of you noticed problems while trying the example provided by the help,
its about the help comes with PYExec
Code: Select all
*
First ensure Python27.dll and imports are in your Macro Scheduler program folder.
Download and unzip this file:
https://www.mjtnet.com/software/python27.zip
*/
Let>url=http://ip.jsontest.com/
/*
python_code:
import urllib2
import json
# grab data from http://ip.jsontest.com/ - see www.jsontest.com
response = urllib2.urlopen('%url%')
# load the json
dict = json.loads(response.read())
# get the ip member
myip = dict["ip"]
# make a nice string representation of the dict
sdict = json.dumps(dict)
# Anything we print to IO is returned in the PYExec output var
print "All Done"
*/
//Load the Python code to a variable
LabelToVar>python_code,pcode
//Run the code and request the values of the sdict and myip variables ...
PYExec>pcode,output,sdict,myip
//Display the IP address
MessageModal>Your pubic IP is: %myip%
But with running this script, i got the error of:
Error exeptions.NameError:name 'pcode' is not defined in the line "PYExec>pcode,output,sdict,myip"
I guess it has to do with importing the libs, but where can i find them?
Thanks for leading me on to the right track,
kind regards,
Djek