Преглед изворни кода

HUE-3617 [editor] Fallback to StringIO if cStringIO isn't available

Jenny Kim пре 9 година
родитељ
комит
9e6317ada3
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

+ 5 - 2
desktop/libs/notebook/src/notebook/connectors/hiveserver2.py

@@ -15,9 +15,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import cStringIO
 import logging
 import re
+try:
+    import cStringIO as StringIO
+except ImportError:
+    import StringIO
 
 from django.core.urlresolvers import reverse
 from django.utils.translation import ugettext as _
@@ -303,7 +306,7 @@ class HS2Api(Api):
 
   def _get_statements(self, hql_query):
     hql_query = strip_trailing_semicolon(hql_query)
-    hql_query_sio = cStringIO.StringIO(hql_query)
+    hql_query_sio = StringIO.StringIO(hql_query)
 
     statements = []
     for (start_row, start_col), (end_row, end_col), statement in split_statements(hql_query_sio.read()):