0

I'm running a toolbox that had previously been able to run smoothly a week prior. The past two days I've been getting the following error:

Traceback (most recent call last):
  File "<string>", line 301, in execute
  File "C:\Program Files\RCAT-1.0.11 -EPP\VBET.py", line 73, in main
    os.mkdir(projPath + os.path.dirname(DEM) + "/Flow")
WindowsError: [Error 123] The filename, directory name, or volume label syntax is incorrect: u'C:\\Users\\Sabrina\\Documents\\VerdeC:\\Users\\Sabrina\\Documents\\Verde/Flow'

Failed to execute (VBETtool).

Here is the Python code referring to in the code:

 if FlowAcc == None:
        arcpy.AddMessage("Calculating drainage area")
        calc_drain_area(DEM)
    elif os.path.exists(os.path.dirname(DEM) + "/Flow"):
        pass
    else:
        os.mkdir(projPath + os.path.dirname(DEM) + "/Flow")
        arcpy.CopyRaster_management(FlowAcc, os.path.dirname(DEM) + "/Flow/" + os.path.basename(FlowAcc))

In researching this error, most of the time this pops up due to an invalid symbol or character so I've tried changing the project folder to one without potentially problematic symbols or characters (Note this run involved a folder with only one word folder names), but continue to get the same error.

I did recently need to run a repair of my ArcGIS due to issues I was having getting it to run while working on this project and am not sure if maybe that may have affected it. Previously it was running really slowly, certain licensed tools weren't working and others were not running properly at all. So I'm not sure if that's related or what. I'm currently working in ArcGIS 10.5 and Python 2.7.1.

  • Welcome to GIS SE! As a new user please take the tour. – Midavalo Feb 2 at 18:24
  • You appear to be combining your path name twice, as projPath and as os.path.dirname(DEM). Remove one of these in os.mkdir(projPath + os.path.dirname(DEM) + "/Flow") and see if that solves the problem – Midavalo Feb 2 at 18:25

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.