Skip to content

Instantly share code, notes, and snippets.

@fedorov
Created October 21, 2015 01:51
Show Gist options
  • Select an option

  • Save fedorov/4f69f0f19da3c2ff0db1 to your computer and use it in GitHub Desktop.

Select an option

Save fedorov/4f69f0f19da3c2ff0db1 to your computer and use it in GitHub Desktop.
urlopen CERTIFICATE_VERIFY_FAILED error
import TCIABrowserLib
c=TCIABrowserLib.TCIAClient(baseUrl='https://services.cancerimagingarchive.net/services/TCIA/TCIA/query')
c.get_collection_values()
import TCIAClient
c=TCIAClient.TCIAClient(baseUrl='https://services.cancerimagingarchive.net/services/TCIA/TCIA/query')
c.get_collection_values()
@fedorov
Copy link
Author

fedorov commented Oct 21, 2015

Problem description

Running the test in gistfile1.py inside Slicer fails with the stack below, running the test in gistfile2.txt directly using either system python, or python-real from the same Slicer nightly does not fail. The reason for 2 separate tests is that TCIABrowserLib depends on vtk and such and cannot be run using stock python.

Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "test.py", line 5, in <module>
    c.get_collection_values()
  File "/Applications/Slicer-nightly/Slicer.app/Contents/Extensions-24649/TCIABrowser/lib/Slicer-4.4/qt-scripted-modules/TCIABrowserLib/TCIAClient.py", line 48, in get_collection_values
    resp = self.execute(serviceUrl , queryParameters)
  File "/Applications/Slicer-nightly/Slicer.app/Contents/Extensions-24649/TCIABrowser/lib/Slicer-4.4/qt-scripted-modules/TCIABrowserLib/TCIAClient.py", line 29, in execute
    resp = urllib2.urlopen(request)
  File "/Applications/Slicer-nightly/Slicer.app/Contents/lib/Python/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/Applications/Slicer-nightly/Slicer.app/Contents/lib/Python/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/Applications/Slicer-nightly/Slicer.app/Contents/lib/Python/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/Applications/Slicer-nightly/Slicer.app/Contents/lib/Python/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/Applications/Slicer-nightly/Slicer.app/Contents/lib/Python/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/Applications/Slicer-nightly/Slicer.app/Contents/lib/Python/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

Steps to reproduce

  1. Clone this repository: https://github.com/QIICR/TCIABrowser
  2. Run either test from TCIABrowser/TCIABrowser/TCIABrowserLib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment