kimo

How do you handle punctuation in path names

Discussion created by kimo on Jun 29, 2012
Latest reply on Jun 30, 2012 by kimo
The convention that you do not use spaces or other special characters in pathnames is long standing but flouted by Microsoft users.
Special characters are "legal" in many operating systems, but by convention are not used in unix, and could not be used in MS DOS.
Because Apple has a "fork" for file names (an alias) there was pressure on MS to allow file names to be full sentences in Windows 3.1.
Hence the "Program <space> Files" that broke all previous DOS code, and allowed ridiculous file names for Word documents.
I suppose it was to provide some rudimentary metadata functionality in the absence of full text searching and even the concept of metadata.

So we all know this and observe the convention, because if we don't, strange unrelated crashes regularly occur.
We kept ARC/INFO Workstation executables out of 'Program Files" and even Python avoids this path on Windows.

Databases have further restrictions for table names and field names, particularly not starting with a digit.
Starting with a digit will still cause crashes if you are using any GRID functions.
Using a source shapefile with paths containing spaces will fail in geoprocessing tools.

My problem now is to 'bullet-proof' models or tools that are intended to be distributed where the path names are no longer under control of the developer.

I have discovered one workaround to the input problem, use a list even if there is only one input. This seems to insulate the path.
lstFC = [r"E:\05 CCAMLR GIS\Circumpolar_shapefiles\Benthic_regionalisation_DelCano_Crozet_level2.shp"]


My second problem is the installation of the tool. The suggested template
A_structure_for_sharing_tools
only works for me if the "toolshare" path is without punctuation or starting with a digit.

Do you have strange path names in your system?
How do you get the tools to work in this environment?

Outcomes