I am trying to convert geopackage file to geodatabase using my python script. It fails with 999999 error. This gdb is further used for the arcgis rest map service. It is only working when the service is stopped. Also, the schema lock is unchecked in the arcgis rest map directory. There is no lock on the gdb folder and no other Esri product is running on that server. I am not sure if it is related to the permissions on the server. Any suggestion is welcome. Using Python 2.7.12 installed with ArcGIS Server 10.5

import sys
import os
import arcpy
#Set workspace
arcpy.env.workspace = r"C:\myFolder\gdb"
# To allow overwriting the outputs change the overwrite option to true.
arcpy.env.overwriteOutput  = True

gpkg_file = r"C:\myFolder\gpkg\geopk.gpkg\filename.file"
# Geodatabase Name
gdb_name = "myGdb.gdb"                                                           
out_path= r"C:\myFolder\gdb"                                           

# Process: Create File Geodatabase
arcpy.CreateFileGDB_management(out_path, gdb_name, out_version="CURRENT")
print("geodatabase " +gdb_name+ " is created")

# Process: Feature Class to Feature Class

out_path = r"C:\myFolder\gdb\myGdb.gdb"
#geodatabase file name
gdb_file_name ="indexarea"

#arcpy.FeatureClassToFeatureClass_conversion(in_features, out_path, out_name)
arcpy.FeatureClassToFeatureClass_conversion(gpkg_file, out_path, gdb_file_name)
print("***geopacakage file successfully converted into geodatabase***")
  • Try using the Copy Features tool instead of FeatureClasstoFeatureClass? – Hornbydd Oct 29 '20 at 15:54

I was able to resolve that issue by changing the code instead of using arcpy.env.workspace = r"C:\myFolder\gdb" I used arcpy.env.workspace = r"C:\myFolder\gdb\myGdb.gdb" that resolve my issue.

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.