title: Python: ImportError: /usr/local/lib/python2.7/lib-dynload/_io.so: undefined symbol: PyUnicodeUCS2_Replace
body: <p>I am trying to build a triviol Python script that will grab data from URL and save it onto the server. Concider the below code:</p>
  
  <pre><code>#!/usr/bin/python
  import pprint
  import json
  import urllib2
  
  def getUSGS_json():
      print "Fetch data from URL"
  
      fileName = 'data/usgsEarthquacks_12Hrs.json'
      url = 'http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson'
      data = urllib2.urlopen(url).read()
  
      if data:
          try:
              with open(fileName) as jsonGetData:
                  filePut = open(fileName, 'w+')
                  #add data
                  filePut.write(data)
                  filePut.close()
  
                  j = json.load(jsonGetData)
                  print j
          except Exception, e:
              print e
              raise
          else:
              pass
          finally:
              pass
      #end if
  #end getUSGS_json
  
  getUSGS_json()
  </code></pre>
  
  <p>Upon running the script I get the following errors:</p>
  
  <pre><code>Traceback (most recent call last):
    File "geoJsonFetch.py", line 4, in &lt;module&gt;
      import urllib2
    File "/usr/local/lib/python2.7/urllib2.py", line 94, in &lt;module&gt;
      import httplib
    File "/usr/local/lib/python2.7/httplib.py", line 79, in &lt;module&gt;
      import mimetools
    File "/usr/local/lib/python2.7/mimetools.py", line 6, in &lt;module&gt;
      import tempfile
    File "/usr/local/lib/python2.7/tempfile.py", line 32, in &lt;module&gt;
      import io as _io
    File "/usr/local/lib/python2.7/io.py", line 51, in &lt;module&gt;
      import _io
  ImportError: /usr/local/lib/python2.7/lib-dynload/_io.so: undefined symbol: PyUnicodeUCS2_Replace
  </code></pre>
  
  <p>I have looked around on SO and found similar errors like <a href="https://stackoverflow.com/questions/11842920/undefined-symbol-pyexc-importerror-when-embedding-python-in-c">this one</a>, but they do not seem to get at the heart of why some people are able to get this code to run and I am not. They all seem to be dealing with issues concerning developing in C and using Python to access that C module. </p>
  
  <p>Is it the Ubuntu version, Python version??</p>
  
  <p>Thank you.</p>