Problem importing urllib/urllib and httplib in arcpy

1255
4
10-30-2017 05:00 AM
by Anonymous User
Not applicable

When I try to import one of those libs my script doesn't run and gives the following error message:

IOError: The toolbox file C:\projetos\CoberturaMassiva\ToolBoxProcessamentoCobertura//toolbox_intersecao_cobertura.pyt was not found.

If I remove the "import httplib", my code runs normally. What's wrong?

4 Replies
JoshuaBixby
MVP Esteemed Contributor

Since the httplib module was renamed in Python 3, are you working with Python 2.x in ArcMap or Python 3.x in ArcGIS Pro?

by Anonymous User
Not applicable

I'm using Python 2.7. But I fixed this problem by chaning my environment varible "PYTHONPATH" by poiting it to Python of ArcGis.

MichaelVolz
Esteemed Contributor

Joshua:

You said: "Since the httplib module was renamed in Python 3, are you working with Python 2.x in ArcMap or Python 3.x in ArcGIS Pro?"

What was the httplib library renamed to in python 3.x for Pro?

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

PEP 3108 -- Standard Library Reorganization | Python.org 

http package

Current NameReplacement Name
httplibhttp.client
BaseHTTPServerhttp.server [2]
CGIHTTPServerhttp.server [2]
SimpleHTTPServerhttp.server [2]
Cookiehttp.cookies
cookielibhttp.cookiejar
[2](1, 2, 3) The http.server module can combine the specified modules safely as they have no naming conflicts.