I'm developing a script to POST a .GDB to a geoprocessing service. Part of my workflow involves opening it while building the POST request:

files = {'file': (open(C:\\Temp.gdb, 'r'))}
r = requests.post(uploadsUrl, files=files, data=data)

I'm able to execute the first line with a personal geodatabase (.mdb) but receive an error when opening a GDB:

IOError: [Errno 13] Permission denied: 'C:\\Temp.gdb'

Is it possible to use the open() command on a file geodatabase? I could read through all feature classes and POST them individually to the REST API, but moving the GDB would be much easier.

  • Ah-- thank you! Will zip it up and work with it from there. Post as an answer and I'll formally accept it. Thanks! Dec 16, 2015 at 18:25

1 Answer 1


A personal geodatabases is a single Access file. A file geodatabase is a collection of a score or more files under a directory (with more files added for each feature class or index). A file I/O open method on a directory is not going to process all the files beneath it.

Instead, you have several options:

  1. You can zip the entire contents of the .gdb directory tree, and transmit the byte stream, then unzip on the receiving end to upload a file geodatabase. Needless to say, this could get large, and you may need to pass in a list of FCs on which to operate.
  2. You can make sure the client and server share a common file system, and pass the name to the feature class appended to the path in which the receiving process will find it (e.g., \\commonhost\volume\transfer\myfgdb.gdb\myfeatureclass)
  3. You can transmit the data in a format other than FGDB for processing (e.g., JSON, Well-Known ASCII delimited text, KML...)

Note that remote filesystems perform significantly worse for FGDB access. Since each geoprocessing service has a "scratch" directory and file geodatabase assigned to it, it would be wise to copy the source data locally before starting to use the feature class. The scratch folder can also be used to receive a zipped dataset (the trickiest part here is writing the service to work locally on the publishing host and on the server)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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