2

When I call arcpy.FeatureClassToFeatureClass_conversion from the PyCharm python console, the where_clause argument is ignored. When a value is supplied, it does not return an error message, nor does it apply the where_clause to the operation. For example:

In[4]: arcpy.FeatureClassToFeatureClass_conversion(r'C:\Workspace\test.gdb\wells', r'C:\Workspace\test.gdb', 'test1', where_clause='This is not sql')

Out[4]: <Result 'C:\\Workspace\\test.gdb\\test1'>

Stranger still, this command works correctly (in the above case, it returns an error) when executed from the Windows command interface (but using the same python environment). The where clause is only ignored in the PyCharm console. I am using arcpy from ArcGIS Pro 2.5.0, and PyCharm 2020.2.

I don't understand why this is happening, and it is compromising some of my workflows.

Can anyone replicate this error, or suggest a solution?

1

I do not have PyCharm installed to test.

However, your syntax of:

arcpy.FeatureClassToFeatureClass_conversion(r'C:\Workspace\test.gdb\wells', r'C:\Workspace\test.gdb', 'test1', where_clause='This is not sql')

seems to match what is required by the tool in its Online Help:

FeatureClassToFeatureClass(in_features, out_path, out_name, {where_clause}, {field_mapping}, {config_keyword})

so I think this must be a PyCharm rather than ArcPy problem.

If it is an option for you to upgrade your versions to the latest (ArcGIS Pro 2.6.2 and PyCharm 2020.2.3) then I think you should do that and retest.

If the problem persists, then I think you should use IDLE's Shell Window to prove to the PyCharm developers that doing this works in the IDLE equivalent to the PyCharm python console and ask them to explain or fix why it does not work in PyCharm.

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.