Py3 fixes for wsdump.
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import code
|
import code
|
||||||
|
import six
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import websocket
|
import websocket
|
||||||
@@ -45,11 +46,15 @@ class InteractiveConsole(code.InteractiveConsole):
|
|||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
def raw_input(self, prompt):
|
def raw_input(self, prompt):
|
||||||
line = raw_input(prompt)
|
if six.PY3:
|
||||||
if ENCODING and ENCODING != "utf-8" and not isinstance(line, unicode):
|
line = input(prompt)
|
||||||
|
else:
|
||||||
|
line = raw_input(prompt)
|
||||||
|
|
||||||
|
if ENCODING and ENCODING != "utf-8" and not isinstance(line, six.text_type):
|
||||||
line = line.decode(ENCODING).encode("utf-8")
|
line = line.decode(ENCODING).encode("utf-8")
|
||||||
elif isinstance(line, unicode):
|
elif isinstance(line, six.text_type):
|
||||||
line = encode("utf-8")
|
line = line.encode("utf-8")
|
||||||
|
|
||||||
return line
|
return line
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user