Select to view content in your preferred language

Python SDE to GDB: Error 00354 (randomly putting ".shp" on some outputs)

739
5
01-13-2023 10:59 AM
Ramon_de_Leon
Frequent Contributor

I have a python script that creates a copy  features and tables from a SDE database (around 400 files).

Ramon_de_Leon_0-1673635994458.png

Every time I run it , I get a couple of "ERROR 000354: The name contains invalid characters" errors. Upon checking the error messages I see that it is putting a ".shp" on the "output feature class" parameters. Every time I run it, it would be a different feature class that get this error.

Ramon_de_Leon_1-1673636099981.png

Anyone else who had experienced this behavior and solved it?

 

 

 

0 Kudos
5 Replies
DavidSolari
Frequent Contributor

As per the good word, if you grab a shapefile with this tool the output will also have the .shp suffix. You're better off with Feature Class To Feature Class and Table to Table instead as this gives you control over the output name.

0 Kudos
Ramon_de_Leon
Frequent Contributor

Hi David, I am  grabbing the feature classes and tables from a SDE database.

I tried both "Feature Class To Feature Class", "Copy Features" "Table to Table" and "Export Table", but when I used those I had lots of problems with "lock" related errors.

That was when I resorted to "Feature Class To Geodatabase".

It's weird because out of hundreds of feature classes, it adds the ".shp" on just a couple of of them and it is random every time I run the script.

0 Kudos
by Anonymous User
Not applicable

You are also converting these Featureclasses and tables to Geodatabases in your code by using the methods ToGeoDatabase_conversion.  Is that intended or are you trying to keep the featureclass/ table file format?  If you want to keep the format, you should use the methods @DavidSolari  posted.

0 Kudos
Ramon_de_Leon
Frequent Contributor

Hi Jeff, see my above reply to David.

I did try use those methods, but had issues with them too.

To keep the file formats on the ToGeodatabase method, I have a created a different lists for the feature classes and tables.

Ramon_de_Leon_0-1673640966519.png

 

0 Kudos
by Anonymous User
Not applicable

Locks can be a pain to work around. If you have the data loaded in Pro or arcmap while running the scripts, it will throw the lock error so make sure that any of the outputs are not open in arc when you run the script. You can include some code to either rename the output for these datasets whose outputs are locked, or skip them so you have a more more solid solution than converting the file types, which I think you would have to convert back to featureclass and table at some point or write more code to handle them.

0 Kudos