Open A Python Port From Erlang: No Reply Messages
Based on Chapter 12 of the OTP in Action book and Cesarini's book I wrote this Erlang code: Erlang: p(Param) -> ?DBG('Starting~n', []), Cmd = 'python test.py', Po
Solution 1:
There are two points:
- make sure that Python does not buffer your output, try running
python -u
inopen_port
- using
term_to_binary/1
andbinary_to_term/1
won't work, since they assume that Python is able to encode/decode Erlang External Term Format, which does not seem to be the case. If you want to go this route, check out ErlPort
Solution 2:
Does your Param contain the command limiter for Python? (in this case I assume newline, "\n"). Also, list_to_binary/1 and then a term_to_binary/1 feels kinda wrong. term_to_binary/1 directly (including the newline) should be sufficient.
Post a Comment for "Open A Python Port From Erlang: No Reply Messages"