arcpy.CreateFolder_management doesn't work on Windows 7

1108
6
08-01-2012 04:35 PM
GIS1
by
New Contributor II
Hi friends,

Can you help me with this?

Script run on Windows 7 results in this:


Traceback (most recent call last):
  File "U:\Tools\Toolbox\PCM_Data_Clip\PCM_Data_Clip.py", line 8, in <module>
    arcpy.CreateFolder_management("C:/PCM/", property)
  File "c:\program files\arcgis\desktop10.1\arcpy\arcpy\management.py", line 14477, in CreateFolder
    raise e
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (CreateFolder).


Failed to execute (PCMDataClip).




Same script run in Windows XP, works fine. Both computers using ArcMap 10.1, script is kept on shared network drive so no differences there.


Anyone know what the issue might be?


Thanks!
Tags (2)
0 Kudos
6 Replies
MichaelVolz
Esteemed Contributor
Can you provide a copy of your script?

Maybe it is referencing a directory on the Windows XP machine that is no longer available in Windows 7.  If you are using direct connections to SDE in your python script, the path to these connections has a different location on a Windows 7 machine than on a Windows XP machine.

I hope this helps.
0 Kudos
GIS1
by
New Contributor II
Thanks Michael,

"C:/PCM/"

is the only directory reference in the script. Might it have something to do with backslashes being forward slashes?
0 Kudos
BartłomiejStaroń
New Contributor III
import os
os.makedirs(r"c:\NewFolede")
0 Kudos
MathewCoyle
Frequent Contributor
Try removing the trailing forward slash. It works fine for me using ArcGIS 10.0 either way though. I'm not even sure why this needs to be part of the arcpy package though, as tlomiej1 said os.makedirs or os.mkdir are already available.
0 Kudos
GIS1
by
New Contributor II
Still happening randomly to me, now on XP.

Ran the same script 3 times for different sets of data each time. First 2 times ran fine, third set it did not like and gave this error....
0 Kudos
AnthonyTimpson2
Occasional Contributor
I use the following to create a Systems PDF folder every time i run this map export script.

import arcpy, os, datetime, sys                                                   

arcpy.env.overwriteOutput = True

#Setup variables
mxd = arcpy.mapping.MapDocument("CURRENT")
mxdPath = mxd.filePath
dataPath = mxdPath.replace(os.path.basename(mxdPath), "System PDFs\\")


try:
    os.makedirs(dataPath)
except OSError:
    if os.path.exists(dataPath):
        # We are nearly safe
        pass
    else:
        # There was an error on creation, so make sure we know about it
        raise

0 Kudos