|
@@ -2,20 +2,29 @@ package python;
|
|
|
|
|
|
import python.lib.Types;
|
|
import python.lib.Types;
|
|
|
|
|
|
|
|
+typedef PySys = python.lib.Sys;
|
|
|
|
+typedef PyStringTools = python.lib.StringTools;
|
|
|
|
|
|
@:preCode("import sys as _hx_sys")
|
|
@:preCode("import sys as _hx_sys")
|
|
class Lib {
|
|
class Lib {
|
|
|
|
|
|
public static function print(v:Dynamic):Void {
|
|
public static function print(v:Dynamic):Void {
|
|
var str = Std.string(v);
|
|
var str = Std.string(v);
|
|
- untyped __python__('_hx_sys.stdout.buffer.write(("%s"%str).encode(\'utf-8\'))');
|
|
|
|
- untyped __python__('_hx_sys.stdout.flush()');
|
|
|
|
|
|
+
|
|
|
|
+ PySys.stdout.buffer.write( PyStringTools.encode(str, "utf-8"));
|
|
|
|
+ PySys.stdout.flush();
|
|
|
|
+ //untyped __python__('_hx_sys.stdout.buffer.write(("%s"%str).encode(\'utf-8\'))');
|
|
|
|
+ //untyped __python__('_hx_sys.stdout.flush()');
|
|
}
|
|
}
|
|
|
|
|
|
public static function println(v:Dynamic):Void {
|
|
public static function println(v:Dynamic):Void {
|
|
var str = Std.string(v);
|
|
var str = Std.string(v);
|
|
- untyped __python__('_hx_sys.stdout.buffer.write(("%s\\n"%str).encode(\'utf-8\'))');
|
|
|
|
- untyped __python__('_hx_sys.stdout.flush()');
|
|
|
|
|
|
+
|
|
|
|
+ PySys.stdout.buffer.write( PyStringTools.encode('$str\n', "utf-8"));
|
|
|
|
+ PySys.stdout.flush();
|
|
|
|
+
|
|
|
|
+ //untyped __python__('_hx_sys.stdout.buffer.write(("%s\\n"%str).encode(\'utf-8\'))');
|
|
|
|
+ //untyped __python__('_hx_sys.stdout.flush()');
|
|
}
|
|
}
|
|
|
|
|
|
public static function toPythonIterable <T>(it:Iterable<T>):python.lib.Types.NativeIterable<T> {
|
|
public static function toPythonIterable <T>(it:Iterable<T>):python.lib.Types.NativeIterable<T> {
|