<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Python script stopped working.  Need help in Python Snippets Questions</title>
    <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801704#M261</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No worries! &lt;A href="https://community.esri.com/migrated-users/8066"&gt;Michael Volz&lt;/A&gt; above mentioned something that I didn't notice. You're making the request over HTTP instead of HTTPS. Do you get the same behavior if you change the URL to https://apps.ohiodnr.gov/geodata/Statewide/OGWells_statewide.zip?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my first post, I'm referring to the certificate presented by apps.ohiodnr.gov and yes, ideally this certificate would pass validation in a script like this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Jul 2020 20:02:04 GMT</pubDate>
    <dc:creator>GeoJosh</dc:creator>
    <dc:date>2020-07-08T20:02:04Z</dc:date>
    <item>
      <title>Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801697#M254</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have a small Python script that essentially downloads a zip file, unzips it, and saves the contents (shapefiles) to a folder on my network.&amp;nbsp; It stopped working not too long ago and I'm not sure why.&amp;nbsp;&amp;nbsp;I was testing each line in the Python Consol, and when it got to the last line shown below (zipresp = urlopen(zipurl)), it gave me a bunch of errors that I don't understand.&amp;nbsp; Can anyone tell me more on the errors?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #cc7832;"&gt;from &lt;/SPAN&gt;urllib.request &lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;urlopen
&lt;SPAN style="color: #cc7832;"&gt;from &lt;/SPAN&gt;zipfile &lt;SPAN style="color: #cc7832;"&gt;import &lt;/SPAN&gt;ZipFile

zipurl = &lt;SPAN style="color: #6a8759;"&gt;"http://apps.ohiodnr.gov/geodata/Statewide/OGWells_statewide.zip"
&lt;/SPAN&gt;&lt;SPAN style="color: #6a8759;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;# Download the file from the URL
&lt;/SPAN&gt;zipresp = urlopen(zipurl)&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 1318, in do_open&lt;BR /&gt; encode_chunked=req.has_header('Transfer-encoding'))&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\http\client.py", line 1254, in request&lt;BR /&gt; self._send_request(method, url, body, headers, encode_chunked)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\http\client.py", line 1300, in _send_request&lt;BR /&gt; self.endheaders(body, encode_chunked=encode_chunked)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\http\client.py", line 1249, in endheaders&lt;BR /&gt; self._send_output(message_body, encode_chunked=encode_chunked)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\http\client.py", line 1036, in _send_output&lt;BR /&gt; self.send(msg)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\http\client.py", line 974, in send&lt;BR /&gt; self.connect()&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\http\client.py", line 1415, in connect&lt;BR /&gt; server_hostname=server_hostname)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ssl.py", line 407, in wrap_socket&lt;BR /&gt; _context=self, _session=session)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ssl.py", line 817, in __init__&lt;BR /&gt; self.do_handshake()&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ssl.py", line 1077, in do_handshake&lt;BR /&gt; self._sslobj.do_handshake()&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\ssl.py", line 689, in do_handshake&lt;BR /&gt; self._sslobj.do_handshake()&lt;BR /&gt;ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;During handling of the above exception, another exception occurred:&lt;BR /&gt;Traceback (most recent call last):&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages\IPython\core\interactiveshell.py", line 3326, in run_code&lt;BR /&gt; exec(code_obj, self.user_global_ns, self.user_ns)&lt;BR /&gt; File "&amp;lt;ipython-input-2-0dab62d9e32b&amp;gt;", line 7, in &amp;lt;module&amp;gt;&lt;BR /&gt; zipresp = urlopen(zipurl)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 223, in urlopen&lt;BR /&gt; return opener.open(url, data, timeout)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 532, in open&lt;BR /&gt; response = meth(req, response)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 642, in http_response&lt;BR /&gt; 'http', request, response, code, msg, hdrs)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 564, in error&lt;BR /&gt; result = self._call_chain(*args)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 504, in _call_chain&lt;BR /&gt; result = func(*args)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 756, in http_error_302&lt;BR /&gt; return self.parent.open(new, timeout=req.timeout)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 526, in open&lt;BR /&gt; response = self._open(req, data)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 544, in _open&lt;BR /&gt; '_open', req)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 504, in _call_chain&lt;BR /&gt; result = func(*args)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 1361, in https_open&lt;BR /&gt; context=self._context, check_hostname=self._check_hostname)&lt;BR /&gt; File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\urllib\request.py", line 1320, in do_open&lt;BR /&gt; raise URLError(err)&lt;BR /&gt;urllib.error.URLError: &amp;lt;urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:852)&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:18:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801697#M254</guid>
      <dc:creator>JohnBrand</dc:creator>
      <dc:date>2021-12-12T09:18:05Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801698#M255</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/11527"&gt;John Brand&lt;/A&gt;‌ were you always using python 3 when it worked? (changes occurred from python 2.7 into 3 and onward)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 14:46:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801698#M255</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2020-07-08T14:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801699#M256</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, I was using python 3 when I originally put the script together.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 15:41:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801699#M256</guid>
      <dc:creator>JohnBrand</dc:creator>
      <dc:date>2020-07-08T15:41:40Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801700#M257</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It looks like the server's certificate can't be validated. Have a look at the top comment in the StackOverflow discussion below. Creating a new SSLContext and passing it with the request should resolve the issue.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error" title="https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error"&gt;python - urllib and "SSL: CERTIFICATE_VERIFY_FAILED" Error - Stack Overflow&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Josh&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 17:51:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801700#M257</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2020-07-08T17:51:44Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801701#M258</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are http requests still allowed?&amp;nbsp; I thought ESRI and the IT industry in general was moving for the more secure https protocol.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 18:50:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801701#M258</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2020-07-08T18:50:34Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801702#M259</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry, I really don't know&amp;nbsp;anything about this stuff.... Who's server certificate are you referring to?&amp;nbsp; Is it good practice to have a certificate verified?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 19:47:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801702#M259</guid>
      <dc:creator>JohnBrand</dc:creator>
      <dc:date>2020-07-08T19:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801703#M260</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You're right, but there's still a large number of organizations who haven't made the switch yet. This line of code should work if the OP can bypass the cert verification step OR make the request over HTTPS.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 19:58:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801703#M260</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2020-07-08T19:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801704#M261</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;No worries! &lt;A href="https://community.esri.com/migrated-users/8066"&gt;Michael Volz&lt;/A&gt; above mentioned something that I didn't notice. You're making the request over HTTP instead of HTTPS. Do you get the same behavior if you change the URL to https://apps.ohiodnr.gov/geodata/Statewide/OGWells_statewide.zip?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my first post, I'm referring to the certificate presented by apps.ohiodnr.gov and yes, ideally this certificate would pass validation in a script like this.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 20:02:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801704#M261</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2020-07-08T20:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801705#M262</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I changed the script to https and I received the error messages again.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 20:45:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801705#M262</guid>
      <dc:creator>JohnBrand</dc:creator>
      <dc:date>2020-07-08T20:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Python script stopped working.  Need help</title>
      <link>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801706#M263</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not sure why that cert is failing validation. As mentioned above, the workaround is to skip the validation process all together. The code below worked for me:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;from urllib.request import urlopen&lt;BR /&gt;from zipfile import ZipFile&lt;BR /&gt;import ssl&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zipurl = "https://apps.ohiodnr.gov/geodata/Statewide/OGWells_statewide.zip"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;# Download the file from the URL&lt;BR /&gt;gcontext = ssl.SSLContext()&lt;BR /&gt;zipresp = urlopen(zipurl, context=gcontext)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Jul 2020 20:50:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/python-snippets-questions/python-script-stopped-working-need-help/m-p/801706#M263</guid>
      <dc:creator>GeoJosh</dc:creator>
      <dc:date>2020-07-08T20:50:37Z</dc:date>
    </item>
  </channel>
</rss>

