my eventual goal is to pass a list of active zones to a python script to access particular elements in the list of active zones. to test this, i'm trying a bit of code I found online, but no matter what i try, a list such as '1,2,5,9,21' will not pass correctly to the python module. if the list is all letters with no commas 'a b c ' or elements with a character as first letter 'a1 a2 ', it works. just numbers won't work and anything with commas won't work.
here's the test macro i'm using:
# Created by Tecplot 360 build 126.96.36.19985
$!varset |activez| = 'a1 a2 '
$!system 'echo activez = |activez|'
COMMANDPROCESSORID = 'Python Utility'
COMMAND = 'LOADPYFILE NAME="test_array"'
COMMAND='RUNPYFUNCTION MODULE="test_array" FUNCTION="fetchcount" ARGUMENTS="|activez|,arraycnt"'
$!system 'echo numarray = |arraycnt|'
here i'm just trying to get a count of the list elements.
here's the python code i found online (file named test_array.py)
from string import split
from string import count
somearray = split(s)
# tecplot indexes arrays from 1; python uses 0
i = count(s," ")
print "s = ",s
so long as my variable |activez| has no commas and each element begins with a character, it works.
if |activez| = '1,2,5,9,11', how do i get that to pass correctly to the python module?
thanks alot. this has been driving me crazy