Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Naming directories in python?

$
0
0

Why is it that when I label my directories this way:

arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\Users\Documents\ArcGIS\Testing"
arcpy.env.scratchWorkspace = "C:\UsersDocuments\ArcGIS\Testing"
scratch = "C:\UsersDocuments\ArcGIS\Testing"
space = "C:\Users\Documents\ArcGIS" #General Directory
workspace = "C:\Users\Documents\ArcGIS\Textfiles" #Where the final product is saved
folder = "C:\Users\Documents\ArcGIS\AQS\site_coordinates\" #Location of the the site data
textfile_place = "C:\Users\Documents\ArcGIS\Textfiles\pollution.txt" #Final Textfile
data = "C:\Users\Documents\ArcGIS\Textfiles\data.txt" #Location of data

it reads all of my data, but when I try to clean it up and make it more transferable across computers like this:

arcpy.env.overwriteOutput = True
arcpy.env.workspace = "C:\Users\Documents\ArcGIS\Testing"
arcpy.env.scratchWorkspace = "C:\Users\Documents\ArcGIS\Testing"
space = "C:\Users\Documents\ArcGIS"
scratch = space + "\Testing"
workspace = space + "\Textfiles"
textfile_place = workspace + "\pollution.txt"
data = workspace + "data.txt"
folder = space + "\AQS\site_coordinates\"

it doesn’t work and says the files don’t exist? I’ve been trying to look on the web but can’t find a solution to the problem. Thanks!


Viewing all articles
Browse latest Browse all 767

Trending Articles