Select to view content in your preferred language

Install py file

1228
6
05-07-2012 05:22 AM
HarisPantelis
Emerging Contributor
Hello there

I am new to the site and relatively new to arcgis. I m using ArcGIS 9.3. I ve downloaded this python script (i am not aware of programming)

Script : http://arcscripts.esri.com/details.asp?dbid=15144

Any one can tell me (from start to finish) how will i install it to arcgis?

Thanks in advance

(i have an attachment with the file)
Tags (2)
0 Kudos
6 Replies
BruceNielsen
Frequent Contributor
To install, first open ArcToolbox in either ArcMap or ArcCatalog. Right-click in ArcToolbox and select "Add Toolbox...". Navigate to the folder where you un-zipped the download, select the .tbx file, and click the Open button.

To edit the script, open the toolbox you just added, right-click the tool and select "Edit".
0 Kudos
HarisPantelis
Emerging Contributor
To install, first open ArcToolbox in either ArcMap or ArcCatalog. Right-click in ArcToolbox and select "Add Toolbox...". Navigate to the folder where you un-zipped the download, select the .tbx file, and click the Open button.

To edit the script, open the toolbox you just added, right-click the tool and select "Edit".


I have done that , and when i opened the py file (edit) i came with that image (1.jpg) attached..

I also found that i can alter the parametres in the foto 2 (untitled.png)..How can i do that?

I ve added the script also (new toolbox-->add script) and i am in the "parameter'' window (2.jpg). Now what?
0 Kudos
BruceNielsen
Frequent Contributor
I'm assuming that you are asking how to turn those script changes into tool parameters. Here's a short course using the first change (strWorkspace - Location of shapefile):

First, find the line in the Python file that starts with "strWorkspace =", replace everything after the equals sign with "gp.GetParameterAsText(0)". Save and close the Python script.

Open the tool's properties, and go to the Parameters tab. In the first box enter a label for the parameter, for example, "Location of Shapefile". For the parameter type, select an appropriate type from the drop-down list. In this case it would be something like "Folder" or "Workspace" (I'm doing this from memory so I don't remember the exact values).

Repeat those two steps for the remainder of the changes you want to turn into parameters. Increment the GetParameterAsText value by 1 each time.
0 Kudos
HarisPantelis
Emerging Contributor
Thanks bruce but there is no "strWorkspace" word inside the python file..:( Have you seen the file in notepad? ( i dont know about python..I guess the language starts where it says

                                         # Collect the input paramers
                                           strAsciiFile = string.replace(gp.getparameterastext(0),"\\","/").....



Furthermore, the py file says:


USER MUST MODIFY PARAMETERS                       #
########################################################################
# strWorkspace - location of shapefile                                 #
# strFileNames - source LAS files                                      #
# strShapeFile - name of shapefile to be created                       #
# strProduct - ArcView, ArcEditor or ArcInfo. Not everyone has ArcInfo

Look at the images below..should it be like that? or what?:(
0 Kudos
BruceNielsen
Frequent Contributor
It looks like the author didn't pay too much attention to updating comments when updating her code. Unfortunately she didn't include a tool in the toolbox to run it either.

Here's what I would recommend: Add the toolbox included in the zip package to ArcMap or ArcCatalog. Right-click on the toolbox and select Add-> Script. Work your way through the wizard, and when you get to the parameters, you only need to enter one: The label will reference the input text file, and the type will be file.

Once that is completed, the tool should be ready to run.
0 Kudos
HarisPantelis
Emerging Contributor
I just did what you said but, it doesnt seem to work either..

When i run the script it says :


"Running script ASCFileToXYZFile...
<type 'exceptions.ImportError'>: No module named os
Failed to execute (ASCFileToXYZFile).
End Time: Tue May 08 00:41:06 2012 (Elapsed Time: 0.00 seconds)"



It is wrong, as it doesnt have an "output" option too:(

* i run both script and ASCII Raster to XYZ file (from zzzSMZ Toolbox)

Any other thoughts?
0 Kudos