boolean variables in toolbox: how are they passed to a python script?

563
2
02-07-2012 06:55 PM
MaartenHofman1
New Contributor
Hi,

Q: how and in what form are boolean variables passed from a toolbox to its python script?

I have a python script that works fine when I use 'True' (text string) as an argument in PythonWin, but when I tick the checkbox in the ArcGIS toolbox, it doesn't seem to work... (script behaves as if it has received a 'False')

I use arcpy.GetParamterAsText(), assuming that even if the argument gets passed as a boolean from the toolbox, it would still be converted to text string. But if it does, shouldn't it be resulting in the same 'True' text string? That doesn't happen, judging from the different behaviour of the script. Or would it be the value 1 that gets passed as a '1' text string?

Any thoughts?

Maarten
Tags (2)
0 Kudos
2 Replies
RaphaelR
Occasional Contributor II
IIRC they´re passed as lower case string.
0 Kudos
MaartenHofman1
New Contributor
Thanks Rafael.
it does seem to get passed in lower case. It works now.

the confusion arose because I used upper case True and False (boolean, NOT str) to set arcpy.env.qualifiedFieldNames and assumed it would work the same for the string arguments passed from the toolbox

thanks again
0 Kudos