Problem with creating InsertCursor

3537
14
09-15-2014 11:50 PM
ChristofLink
New Contributor II

Hi,

I want to write a small tool, which insert some data into an MS-Access database (.mdb). But i have a problem to initialize the cursor.

The Code is very simple :

strOutputPath = r"I:\Data\Test.mdb\FS_BASEMAP\FCL_B_COVERSHEET_A"

icur = arcpy.InsertCursor(strOutputPath)

There is some more code but it stoped at this point and I get this error message:

Traceback (most recent call last):

  File "I:\Skript\AddFeatureSkript.py", line 70, in <module>

    icur = arcpy.InsertCursor(strOutputPath)

  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\__init__.py", line 1214, in InsertCursor

    return gp.insertCursor(dataset, spatial_reference)

  File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 369, in insertCursor

    self._gp.InsertCursor(*gp_fixargs(args, True)))

RuntimeError: ERROR 999999: Fehler beim Ausführen der Funktion.

COM-Komponente der Objektklassenerweiterung konnte nicht erstellt werden. [FCL_B_COVERSHEET_A]

The error message is in german so I translate it:

ERROR 999999: Error when executing the function.
COM component object class extension could not be created. [FCL_B_COVERSHEET_A]

I don't know what the problem is, so hopefully some can help me.

Thanks, Regards

0 Kudos
14 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Christof,

I believe you are running your script with Python 64-bit, which no longer supports personal geodatabases (.mdb).  You will want to run the script with Python 32-bit.  Take a look at the section 'Python scripting' in the following link:

ArcGIS Help (10.2, 10.2.1, and 10.2.2)

0 Kudos
ChristofLink
New Contributor II

Hey Jake,

thanks for your answer, but I have only a 32 bit version of python installed on my computer and even the ArcGIS is 32 bit.

I just looked it up.

0 Kudos
ChristofLink
New Contributor II

*push*

0 Kudos
JakeSkinner
Esri Esteemed Contributor

As a test, can you copy the data to a File Geodatabase and see if you receive the error?

0 Kudos
ChristofLink
New Contributor II

So I tried it with a .gdb and used arcpy.da.InsertCursor and I works. I get no error message there, but unsing a .gdb isn't an option because the provided data is in the .mdb format.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

What is the error message if you use arcpy.da.InsertCursor instead of arcpy.InsertCursor?  Do you have a requirement to use the older InsertCursor?  Besides better performance, the data access InsertCursor supports Python's with statement, which I find to be a big plus.

0 Kudos
ChristofLink
New Contributor II

If I use arcpy.da.InsertCursor. I get this error message:

Traceback (most recent call last):

  File "I:\Skripte\\AddFeatureSkriptv.py", line 70, in <module>

    icur = arcpy.da.InsertCursor(strOutputPath, ["SHAPE@"])

RuntimeError: cannot open 'I:\Test.mdb\FDS_BASEMAP\FCL_B_COVERSHEET_A'

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

A few things come to mind.

  1. I: drive, mapped network drive or local storage?  If mapped network drive, have you tried copying the MDB to local storage and testing it.
  2. Can you create a new MDB and copy the data into it?  If so, does that give same error messages?
  3. Can you make an OLE DB connection to the MDB in question?
0 Kudos
ChristofLink
New Contributor II

Sry I was on vacation the last 2 weeks.

1. The I drive is a network drive but I also tried it with the local drive and I get the same error message.

2. I creaded a new MDB but even this dosen't work.

3. Yes I can make a OLE DB connection to the MDB.

0 Kudos