0

I’m trying to use the ArcPy Python module to create a geodatabase to store information. I am currently running ArcPy in Visual Studio on a Windows 10 machine.

The function I am trying to use is:

arcpy.management.CreateFileGDB(out_folder_path, out_name, {out_version})

With following inputs defined as:

out_folder_path = 'C:/FILEPATH',
out_name = "geodatabase.gdb",
out_version = '10.0'

When I run the function I receive the following error

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 23214, in CreateFileGDB

raise e

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 23211, in CreateFileGDB

retval = convertArcObjectToPythonObject(gp.CreateFileGDB_management(*gp_fixargs((out_folder_path, out_name, out_version), True)))

File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing_base.py", line 512, in

return lambda *args: val(*gp_fixargs(args, True)) RuntimeError: Object: Error in executing tool

PS C:\Users\USER

I have set up ArcPy on my PC in Visual Studio, I receive the following error upon running it which may be related however this does not seem to impact the module for other functions:

PS C:\Users\USER> conda activate arcgispro-py3 conda : The term 'conda' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1

  • conda activate arcgispro-py3
  • + CategoryInfo          : ObjectNotFound: (conda:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
    

1 Answer 1

1

As a first start I would try to run your code in the Python console within ArcPro. If that runs as expected it would at least confirm the arcpy installation is OK. Then search the esri website on how to set up visual studio correctly. I don't use Visual Studio, I use the spyder IDE which integrates seamlessly with ArcPro. I put a document together here if you are interested?

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.