Technical support and scripting issues
Moderators: JRL, Dorian (MJT support)
-
ocnuybear
- Pro Scripter
- Posts: 100
- Joined: Sun Jul 15, 2018 5:14 pm
Post
by ocnuybear » Mon Sep 03, 2018 4:33 pm
The code below runs 100% when double clicking the script in explorer under path 'C:\Users\John\Documents\Macro Scheduler 14', but when running it within MS it says 'Python is not properly initialized', the python27.dll file is also present in the same path as the script: 'C:\Users\John\Documents\Macro Scheduler 14'.
Restarted & reinstalled MS, but problem persists
Code: Select all
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%
Last edited by
ocnuybear on Tue Sep 04, 2018 5:13 am, edited 1 time in total.
-
Grovkillen
- Automation Wizard
- Posts: 1132
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
-
Contact:
Post
by Grovkillen » Mon Sep 03, 2018 6:32 pm
You need to provide the libraries "urllib2" and "json" with the same folder/file structure as you see in the Python installation folder.
-
ocnuybear
- Pro Scripter
- Posts: 100
- Joined: Sun Jul 15, 2018 5:14 pm
Post
by ocnuybear » Tue Sep 04, 2018 5:13 am
Just realized I have extracted the python files into the MS Documents folder 'C:\Users\John\Documents\Macro Scheduler 14' instead of using MS Installation folder 'C:\Program Files (x86)\Macro Scheduler 14'
One's eye tends to look at the last part & sometimes misses the first part
