Select to view content in your preferred language

CopyFeature Script returning tuple error

985
4
Jump to solution
04-21-2023 08:39 AM
KitJones
Emerging Contributor

I am trying to copy features from one feature class to another and for some reason I keep getting the error:

TypeError: 'tuple' object is not callable

 

import arcpy

from arcpy import env

Ceramic='E:\\GIS Data Generic\\Associated Artifacts\\Associated Artifacts.gdb\\Ceramic'

selCeramic='E:\\GIS Data Generic\\Associated Artifacts\\Associated Artifacts.gdb\\Ceramic_Selected'

arcpy.management.CopyFeatures(Ceramic, selCeramic)

 

I've tried putting the file path directly into the function as well and am receiving the same error.

Other functions such as ExportTable and DeleteFeatures are working fine so I'm not sure why it is reading anything as a tuple.

0 Kudos
1 Solution

Accepted Solutions
DavidPike
MVP Notable Contributor

looks ok, I'd prefer to use raw formatting on the path r'E:\Stuff.gdb\thing' so maybe try that.

Space in GDB names - probably not recommended

import env - what for?  Is this part of a longer script?  There must be more going on here.

View solution in original post

0 Kudos
4 Replies
Mahdi_Ch
Regular Contributor

First you need to read the project, let's say you opened the project "Associated Artifacts"

 

import arcpy
aprx = arcpy.mp.ArcGISProject("CURRENT")

 

 then you can reference the layers/Featureclasses by their name (string) and no need to pass the full path. 

Also, from expand toolbar please use "insert/edit code sample" to show your code, that would make it easier to read.  

0 Kudos
KitJones
Emerging Contributor

This is eventually going to be part of a tool so I will eventually read in a geodatabase as a parameter using arcpy.env.workspace. Noted on the code, figured there was an easier way.

0 Kudos
DavidPike
MVP Notable Contributor

looks ok, I'd prefer to use raw formatting on the path r'E:\Stuff.gdb\thing' so maybe try that.

Space in GDB names - probably not recommended

import env - what for?  Is this part of a longer script?  There must be more going on here.

0 Kudos
KitJones
Emerging Contributor

So I think it must have been the space in the geodatabase since I changed that one thing and now it's working perfectly.  So odd that every other function worked fine with the space except for this one. Thanks!