4

I have a Python script that I have made to some basic data management tasks. I want to package up a Python script in a nice user friendly way for an end user to run, they do not know how to run Python scripts and I need them to input some parameters in an easy way i.e. say a filename.

What is the best way to do this?

2
  • Does anyone else feel that this question is a duplicate of gis.stackexchange.com/q/18798/4681?
    – nmpeterson
    Jan 17, 2012 at 16:20
  • Sorry - yes it is very similar - woops... I'm happy to ditch this question - althought Chad Cooper has put a nice answer down too....
    – Vidar
    Jan 17, 2012 at 18:19

4 Answers 4

6

Creating a custom tool for use within arctoolbox. There are several sections within the help files that are useful, see A quick tour of creating custom tools as a starting point.

4

You could use a combination of Python's built-in raw_input function and a batch file. Both live in the same directory, the batch file calls the script (so all they have to do is 2X click on the batch file), and raw_input asks them for the needed inputs. Example Python code in untitled-2.py:

name = raw_input("Enter name:")
print "Hello", name

Contents of batch file:

python untitled-2.py
pause

I put the pause in there so we could see the output after I 2X clicked on the batch file:

enter image description here

So all your user has to do is place both the Python script and the batch file in the same location on their box, double-click on the batch file, and enter in whatever is asked of them.

1

Also note that if you're accessing arcpy, you're going to need to install the required software on their computer, including access to an arcGIS license. (I can't say whether you can get by just installing the license manager and the arcgis python installation, or you need to install the entire desktop software package).

I've put python scripts on a number of desktops in my organization for automating functions.

If you're editing using idle, then just save the .py file and have them run it. It'll run through a command line like the one linked above. The combination of modelbuilder and it's 'export to python' option is really quite a timesaver too if you're not too familiar with working with the environment.

0

At ArcGIS Desktop 10.0, which you tagged, this would not have been an option, but nowadays what you describe sounds like the use case for a geoprocessing package:

Geoprocessing packages are created from one or more results in the Results window. All the data and tools used to create the result are included in the package. You can add additional files to the package, such as text documents, slide shows, and compressed ZIP files. Your colleague unpacks the package to immediately begin using its contents.

There is a page in that topic titled Packaging Python scripts.

Not the answer you're looking for? Browse other questions tagged or ask your own question.