handling spaces in variables in Python

Discussion created by dedge on Nov 15, 2010
Latest reply on Nov 19, 2010 by dhoneycutt-esristaff
Greetings All

I'm trying to write a script that takes a dataset from the drop-down option in a tool, extracts the filename and folder path from it, determine whether the folder is a normal folder or a gdb, queries the type of dataset it is (point, line, polygon, raster) and write it all to a text file.

Unfortunately, the way our file system is setup is causing me pain. Here's a typical filepath:
J:\MMPL\60153995\4. Tech Work Area\4.7 GIS\Mike11_data.gdb\DHI_CrossSections

* Note the spaces in the path

My problem is that when trying to run the script in PythonWin I have to insert the whole path in "" "" to get Python to see it as one variable.
If I don't, it thinks that only J:\MMPL\60153995\4. is the variable's contents

But that works as I can use os.path.dirname & os.path.basename to extract the filename & folderpath.
BUT....I can't use the variable in a Describe on that variable. It returns a 999999 RunTimeError.

The goal is to have a script that I can use to populate a data register of sorts. I wasn't expecting to get bogged down on this simple first bit...argh.

Any help would be greatly appreciated.