mirror of
https://kkgithub.com/chinese-poetry/chinese-poetry.git
synced 2026-04-13 05:07:16 +00:00
reload() was moved into importlib in Python 3
The builtin __reload()__ was moved into [importlib](https://docs.python.org/3/library/importlib.html#importlib.reload) in Python 3 because it was being overused and led to odd behavior that was often difficult to diagnose. Here we are trying to __reload(sys)__ probably because 'utf-8' encoding and Unicode strs are not the default in Python 2. They are however the default in Python 3 so this PR therefor suggests that a __pass__ would be satisfactory in Python 3.
This commit is contained in:
@@ -4,10 +4,11 @@ import json, sys
|
|||||||
import sqlite3
|
import sqlite3
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
try: # Python 2
|
||||||
reload(sys)
|
reload(sys)
|
||||||
sys.setdefaultencoding('utf-8')
|
sys.setdefaultencoding('utf-8')
|
||||||
|
except NameError: # Python 3
|
||||||
|
pass
|
||||||
|
|
||||||
c = sqlite3.connect('ci.db')
|
c = sqlite3.connect('ci.db')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user