diff --git a/examples/generator.erl b/examples/generator.erl index fe031d2b..40b59817 100644 --- a/examples/generator.erl +++ b/examples/generator.erl @@ -3,7 +3,7 @@ generate(N) when N >= 0 -> Port = open_port({spawn, "python handler.py"}, - [{packet, 1}, nouse_stdio, binary, {env, [{"PYTHONPATH", "../src"}]}]), + [{packet, 4}, nouse_stdio, binary, {env, [{"PYTHONPATH", "../src"}]}]), generate(Port, N), receive {Port, {data, Data}} -> diff --git a/examples/handler.py b/examples/handler.py index a1baabd7..4c84fb1f 100644 --- a/examples/handler.py +++ b/examples/handler.py @@ -17,4 +17,4 @@ def handle(self, port, message): if __name__ == "__main__": proto = EventHandler() - proto.run(Port()) + proto.run(Port(packet=4)) diff --git a/examples/hello.erl b/examples/hello.erl index 2d0e5b9f..d430decd 100644 --- a/examples/hello.erl +++ b/examples/hello.erl @@ -1,7 +1,7 @@ -module(hello). -export([hello/1]). -hello(Name) -> +hello(Name) when is_list(Name) -> Port = open_port({spawn, "python hello.py"}, [{packet, 1}, nouse_stdio, binary, {env, [{"PYTHONPATH", "../src"}]}]), port_command(Port, term_to_binary({hello, Name})), diff --git a/examples/hello.py b/examples/hello.py index fbb6733f..2e674805 100644 --- a/examples/hello.py +++ b/examples/hello.py @@ -1,10 +1,10 @@ -from erlport import Port, Protocol +from erlport import Port, Protocol, String class HelloProtocol(Protocol): def handle_hello(self, name): - return "Hello, %s" % name + return "Hello, %s" % String(name) if __name__ == "__main__":