Select to view content in your preferred language

Moving script tool and toolbox causes errors

1993
0
01-08-2014 05:33 AM
BrendanDwyer
Frequent Contributor
I created a script tool that extracts rows from a csv file and writes them to a new csv file.  When I use it on the machine I wrote it on, it works fine.  Then I copied it up to a network drive so other users could access it (either directly, or add the toolbox to their arcgis profile).  When other people use it, using the same files I'm used to test it and writing to directories where they have write access, we get an IO error ("IOError: [Errno 13] Permission denied: u'C:\\Users\\<user>\\My Documents'").

Here is the python code:
import arcpy
import os
import csv

inputCSV = arcpy.GetParameterAsText(0)
newCSV = arcpy.GetParameterAsText(1)
countryCode = arcpy.GetParameterAsText(2)

with open(inputCSV, 'rb',) as f:
    reader = csv.reader(f,delimiter='\t')
    newcsv = open(newCSV,'wb')
    newWriter = csv.writer(newcsv,quoting=csv.QUOTE_ALL) # this is the line that throws the error
    for i in range(430941):
        rw= reader.next()
        if(rw[52]==countryCode):
            print rw
            newWriter.writerow(rw)

Any ideas why this would work on my machine and not on anyone elses?
Tags (2)
0 Kudos
0 Replies