arcpy import failures in some IDEs

333
0
10-25-2017 12:08 PM
JenniferBaughman1
New Contributor II

Not a question, per se, because I've solved it, but since it's impossible to report a bug to ESRI, I wanted to make sure the fix was available somewhere.

In PyCharm and other IDEs, an attempt to import `arcpy` throws one of the two following errors:

error: [Errno 10054] An existing connection was forcibly closed by the remote host

or

error: [Errno 10053] An established connection was aborted by the software in your host machine

In the `interop.py` module, the docstrings for QuickImport and QuickExport contain URLs that do not have slashes properly escaped. Because the docstring isn't a raw string, the slashes are thus considered to start escape characters, as typical for Python string parsing. (\a seems to be the culprit in this case.) This causes an error on import in some IDEs. The fix is simple: escape out all slashes in URLs contained in the docstrings. Thus, instead of this:

* The ** characters match any subdirectories, recursively. For instance, c:\data\**\*.mif will match c:\data\roads.mif, c:\data\canada\rivers.mif, and c:\data\canada\alberta\edmonton.mif.

the docstring should include this:

* The ** characters match any subdirectories, recursively. For instance, c:\\data\\**\\*.mif will match c:\\data\\roads.mif, c:\\data\\canada\\rivers.mif, and c:\\data\\canada\\alberta\\edmonton.mif.

I manually edited `interop.py` to resolve the issue, but I was hoping to notify ESRI so that they could fix the issue on their end.

Tags (1)
0 Kudos
0 Replies