Skip to content

Commit

Permalink
Fix python2 & 3 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
nyanye committed May 18, 2018
1 parent f4ad963 commit ff0d2d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
10 changes: 8 additions & 2 deletions konlpy/csvutils.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import sys
import csv
import codecs
import cStringIO

# Python 2 & 3 Compatibility
if sys.version_info[0] >= 3:
from io import StringIO as cStringIO
else:
import cStringIO


def _stringify(s, encoding="utf-8"):
Expand Down
11 changes: 6 additions & 5 deletions konlpy/data.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import absolute_import

import os
import sys
import textwrap
try:
import cPickle as pickle
except:

if sys.version_info[0] >= 3:
import pickle
else:
import cPickle as pickle

from . import utils
from konlpy import utils


#: A dictionary describing the formats that are supported by
Expand Down

0 comments on commit ff0d2d9

Please sign in to comment.