Python Script Tools: Setup

1302
7
08-29-2016 02:32 AM
PeterWilson
Occasional Contributor III

I've been creating Python Scripts and Program's for years, but have never really needed to share my script with anyone else. I generally run them directly from my IDE manually or schedule them to run from my server.

I'm currently helping out a colleague and have written a Python Script for them. I added the python script to a a ArcToolbox and found my first stumbling block. The formatting of the Description is not maintained. As can be seen from below the paragraphs are clearly visible within the properties of the script:

Python Script Tool: Properties

Python Script Tool: Paragraphs are dropped.

Where can I find documentation on controlling how the description and help documentation is displayed and how to customize it?

The second problem that I picked up is that the Data Type integer (Int\Short) is not available from the drop down list of data_types:

Data Type: Short Missing from drop down list ???

I've changed the type to "Long" for now which seems unnecessary and converted it to an integer within my Python Script. Whats the reasoning that Integer Data Type is not available within the available data types?

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

Peter, there are several link in the help using 'documenting tools' as a search, ie.

A quick tour of documenting tools and toolboxes—Help | ArcGIS for Desktop 

As for the short vs long... to make a long story short, use long, I can't find the link but there were some 'issues' around the use of short, that I can't find right now.  In the big picture, if short vs long is going to 'break' things, then there are bigger issues.

ps ... try ctrl enter for the extra line space, I always have to try before I remember

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

I'd agree that there is flakiness with trying to keep the formatting for description of tools.  What I found to semi-works lately, is to use html code in the Tool parameter description box ... e.g  <br><br> and <u><li> etc., the use the Description tab in catalog....and go back and forth.  Kind of a pain, but I have been able to get the formatting, including lists and text formatting to stick.  There may be other ways like starting int he Description (as the link Dan sent shows), but most of mine already had some description from the tool box. 

Sample...but some html code in the toolbox

look at it in Description tab, doesn't look right (results var)

go into EDIT from the descirption

   

Save, with no other changes

The sidebar help in the tool

Sometimes I can continue editing in the Description box and have the formatting stick...sometimes I have to go back, add a little more html tags for wha tI'm trying to do, and then go edit in the description key again, and it will work.....and may need to inthis case because it now looks like it has an extra <br>    Not a smooth process, and again, maybe starting in the Description tab to begin with might help.  I haven't tested fully.

0 Kudos
NeilAyres
MVP Alum

Brilliant Rebecca. But sometimes, the hoops you have to jump through...

btw there's a spelling mistake "repalce"

0 Kudos
RebeccaStrauch__GISP
MVP Emeritus

lol.  Thanks Neil.  Can't even blame that one on the ipad auto correct.  Luckily it was just for demo purposes (need to rewrite the tool since that was for AGSSOM...older ArcGIS Server).   

0 Kudos
PeterWilson
Occasional Contributor III

Hi Rebecca

Thanks for the following, it truly helpful

0 Kudos
curtvprice
MVP Esteemed Contributor

I eschew that interface and use the Metadata Editor instead.

0 Kudos
curtvprice
MVP Esteemed Contributor

About Short vs Long

Here's a little secret. When you pass parameters to a tool (anywhere) the parameter as passed in text representation.  When your script reads the value with GetParameterAsText() you always get that text representation. So Short and Long are really the same thing.

Short and Long are really only critical when defining table fields, in memory Python stores all the precision you will need.

BTW GetParameter() and the system will look at the parameter definition and give you a long instead of text. However the usual (and generally more robust) practice is to always use GetParameterAsText, and convert to a number in your Python script with int().

0 Kudos