cjen07

cjen07

Elixir call python by ports

Is there a way to call python using ports, and get the result by receive block?
Example code is preferred, thanks in advance.

Most Liked

michalmuskala

michalmuskala

Here’s a great article on ports: The Erlangelist - Outside Elixir

It uses Ruby, not Python, but the general approach should be exactly the same.

NobbZ

NobbZ

There is no need in using the library, you are free to do all the work again and on your own, that has already been done by the ErlPorts team.


Perhaps you can show us what you have, and what you expect it to do and describe what it does instead. Maybe we can help you to fix it?

NobbZ

NobbZ

{:packet, 4} means, that you need 4 bytes denoting the lenght of the message and no newline after that (unless its part of the message).

In elixir syntax the message has to look like this:

<<4::integer-size(4)-unit(8), "asdf">>
# or
<<0, 0, 0, 4, 97, 115, 100, 102>>

Last Post!

micahrye

micahrye

Thanks @NobbZ, @sasajuric, @OvermindDL1, community always rooks!

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

Other popular topics Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 31525 112
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 40082 209
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement