我一直在使用以前的版本来编写用于ArcGIS处理的python脚本。为此,您需要导入arcpy python API - ArcGIS。这一直都很好,但现在我似乎不能直接访问arcpy。
我已经将ArcGIS位置添加到我的python路径和项目设置路径中,并且可以实例化arcpy对象的实例,但尝试与顶级方法或类交互时会产生套接字服务器错误(如下所示)。例如,在交互式提示符中:
>> import arcpy - will work
but typing
>> arcpy. - will instantly generate
Traceback (most recent call last):
File "C:\Python27\ArcGIS10.3\lib\SocketServer.py", line 295, in _handle_request_noblock
Exception happened during processing of request from ('127.0.0.1', 59487)
self.process_request(request, client_address)
File "C:\Python27\ArcGIS10.3\lib\SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "C:\Python27\ArcGIS10.3\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\ArcGIS10.3\lib\SocketServer.py", line 653, in __init__
self.finish()
File "C:\Python27\ArcGIS10.3\lib\SocketServer.py", line 712, in finish
self.wfile.close()
File "C:\Python27\ArcGIS10.3\lib\socket.py", line 279, in close
self.flush()
File "C:\Python27\ArcGIS10.3\lib\socket.py", line 303, in flush
self._sock.sendall(view[write_offset:write_offset+buffer_size])
error: [Errno 10053] An established connection was aborted by the software in your host machine
但是-例如,如果我忽略它并实例化地图文档的实例
>>import arcpy
>>fullpath = r'C:\Temp\some.mxd' # where this is a valid ESRI map doc
>> my_mapdoc_object = arcpy.mapping.MapDocument(fullpath)
我现在可以与对象进行交互了。在设置我的环境时,我做错了什么?
发布于 2015-12-16 23:14:57
似乎是PyCharm忽略的文档字符串问题。
在arcpy中,在一个工具函数的文档字符串中,数据路径中有一个转义字符,特别是\a。如果这一点得到纠正,错误就会消失。
https://stackoverflow.com/questions/34147609
复制相似问题