0

I have a script that prints and exports a batch of MXDs. It runs fine as long as the lenght of the path and mxd are shorter. I can't tell what the 'sweet spot' is, but I know it runs fine on my c:/temp and doesn't run well when it gets to over 30 characters. The file structure is setup very lengthy and cumbersome and probably not going to change. Is there a way to temporary copy these files to temporary location on the C: drive then loop into the rest of script? Something like this.

 import arcpy
 import shutil

 temp = r"C:/temp"
 for Copymxd in InputMXDs
      shutil.move(Copymxd, temp)
      for MXDPath in temp:
           #This is the rest of the script
  • 1
    Have you looked at arcpy.Copy_management (followed by arcpy.Delete_management if you want to accomplish a move)? – PolyGeo Feb 7 '14 at 20:12
  • are you sure that it is a problem of length and not of spcial character ? – radouxju Feb 7 '14 at 20:27
  • You don't need the raw format r"C:/temp" if you are using forward slashes – user681 Feb 8 '14 at 3:45
  • I took the file and put it on my desktop and it ran the script fine. I still think it has to do with the length of the path. I'll give Copy_Management a try on Monday. I can't login remotely right now. Thanks for the suggestions. – MjonesGEO Feb 8 '14 at 16:06
  • Have you administration rights to copy or create a new file in c:/temp ! – user3120 Feb 10 '14 at 4:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.