fazibear / export Goto Github PK
View Code? Open in Web Editor NEWErlport wrapper for Elixir
License: MIT License
Erlport wrapper for Elixir
License: MIT License
$ mix deps.compile
===> Analyzing applications...
===> Compiling erlport
==> export
Compiling 4 files (.ex)
warning: Atom.to_char_list/1 is deprecated. Use Atom.to_charlist/1 instead
lib/export/helpers.ex:9: Export.Helpers.convert_options/1
warning: String.to_char_list/1 is deprecated. Use String.to_charlist/1 instead
Found at 2 locations:
lib/export/helpers.ex:9: Export.Helpers.convert_options/1
lib/export/helpers.ex:12: Export.Helpers.convert_options/1
Generated export app
iex(8)> Ruby.start(:test, [ruby_lib: "/app/apps/mongo/priv"])
** (FunctionClauseError) no function clause matching in :gen.where/1
(stdlib) gen.erl:297: :gen.where(:andrew)
(stdlib) gen.erl:75: :gen.start/6
Elixir Version: 1.4.1 and 1.4.2
export version: 0.1.0
If we look closely to these tables -> columns for erlang binary() to python bytes() for [python3 only] vise versa.
This basically means that arguments of str() data type in erlang sent over to python functions will be converted to bytes() in python3.
So for python functions expecting arguments of str() data type, do not forget to convert the received arguments back to python string before using.
# gist ref
decoded_args = locals()
for arg_name, arg_value in locals().items():
if isinstance(arg_value, bytes):
decoded_args[arg_name] = arg_value.decode("utf-8")
I know there haven't been a lot of changes since 2017, but the OTP-21 support at least seems big enough to bump the version.
Trying to build this from source leads to the following errors:
jose@devbox:~/export (master *%)$ mix test
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erlport/cli (LoadError)
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
=ERROR REPORT==== 24-Apr-2019::14:18:50.851078 ===
** Generic server name terminating
** Last message in was {#Port<0.6>,{exit_status,1}}
** When Server state == {state,infinity,0,#Port<0.6>,
[{1,
{{<0.177.0>,
#Ref<0.1331792202.2041577475.72287>},
undefined}}],
[]}
** Reason for termination ==
** {port_closed,{code,1}}
=CRASH REPORT==== 24-Apr-2019::14:18:50.857599 ===
crasher:
initial call: erlport:init/1
pid: <0.178.0>
registered_name: name
exception exit: {port_closed,{code,1}}
in function gen_server:handle_common_reply/8 (gen_server.erl, line 751)
ancestors: [<0.177.0>]
message_queue_len: 1
messages: [{'EXIT',#Port<0.6>,normal}]
links: []
dictionary: []
trap_exit: true
status: running
heap_size: 2586
stack_size: 27
reductions: 4571
neighbours:
1) test Ruby.start with name (ExportRubyTest)
test/export_ruby_test.exs:14
** (ErlangError) Erlang error: {:port_closed, {:code, 1}}
code: result = pid |> Ruby.call("test", "upcase", ["hello"])
stacktrace:
(erlport) /export/home/jose/export/deps/erlport/src/erlport.erl:234: :erlport.call/3
test/export_ruby_test.exs:16: (test)
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erlport/cli (LoadError)
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
=ERROR REPORT==== 24-Apr-2019::14:18:50.895793 ===
** Generic server name terminating
** Last message in was {#Port<0.8>,{exit_status,1}}
** When Server state == {state,infinity,0,#Port<0.8>,
[{1,
{{<0.179.0>,
#Ref<0.1331792202.2041577473.73492>},
undefined}}],
[]}
** Reason for termination ==
** {port_closed,{code,1}}
=CRASH REPORT==== 24-Apr-2019::14:18:50.896061 ===
crasher:
initial call: erlport:init/1
pid: <0.180.0>
registered_name: []
exception exit: {port_closed,{code,1}}
in function gen_server:handle_common_reply/8 (gen_server.erl, line 751)
ancestors: [<0.179.0>]
message_queue_len: 1
messages: [{'EXIT',#Port<0.8>,normal}]
links: []
dictionary: []
trap_exit: true
status: running
heap_size: 1598
stack_size: 27
reductions: 4485
neighbours:
2) test Ruby.start with global name (ExportRubyTest)
test/export_ruby_test.exs:21
** (ErlangError) Erlang error: {:port_closed, {:code, 1}}
code: result = pid |> Ruby.call("test", "upcase", ["hello"])
stacktrace:
(erlport) /export/home/jose/export/deps/erlport/src/erlport.erl:234: :erlport.call/3
test/export_ruby_test.exs:23: (test)
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erlport/cli (LoadError)
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
=ERROR REPORT==== 24-Apr-2019::14:18:50.935981 ===
** Generic server <0.182.0> terminating
** Last message in was {#Port<0.10>,{exit_status,1}}
** When Server state == {state,infinity,0,#Port<0.10>,
[{1,
{{<0.181.0>,
#Ref<0.1331792202.2041577473.73513>},
undefined}}],
[]}
** Reason for termination ==
** {port_closed,{code,1}}
=CRASH REPORT==== 24-Apr-2019::14:18:50.936280 ===
crasher:
initial call: erlport:init/1
pid: <0.182.0>
registered_name: []
exception exit: {port_closed,{code,1}}
in function gen_server:handle_common_reply/8 (gen_server.erl, line 751)
ancestors: [<0.181.0>]
message_queue_len: 1
messages: [{'EXIT',#Port<0.10>,normal}]
links: []
dictionary: []
trap_exit: true
status: running
heap_size: 1598
stack_size: 27
reductions: 4463
neighbours:
3) test Ruby.start (ExportRubyTest)
test/export_ruby_test.exs:7
** (ErlangError) Erlang error: {:port_closed, {:code, 1}}
code: result = pid |> Ruby.call("test", "upcase", ["hello"])
stacktrace:
(erlport) /export/home/jose/export/deps/erlport/src/erlport.erl:234: :erlport.call/3
test/export_ruby_test.exs:9: (test)
/usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- erlport/cli (LoadError)
from /usr/share/rubygems/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
=ERROR REPORT==== 24-Apr-2019::14:18:50.975822 ===
** Generic server <0.184.0> terminating
** Last message in was {#Port<0.12>,{exit_status,1}}
** When Server state == {state,infinity,0,#Port<0.12>,
[{1,
{{<0.183.0>,
#Ref<0.1331792202.2041577473.73533>},
undefined}}],
[]}
** Reason for termination ==
** {port_closed,{code,1}}
=CRASH REPORT==== 24-Apr-2019::14:18:50.976093 ===
crasher:
initial call: erlport:init/1
pid: <0.184.0>
registered_name: []
exception exit: {port_closed,{code,1}}
in function gen_server:handle_common_reply/8 (gen_server.erl, line 751)
ancestors: [<0.183.0>]
message_queue_len: 1
messages: [{'EXIT',#Port<0.12>,normal}]
links: []
dictionary: []
trap_exit: true
status: running
heap_size: 1598
stack_size: 27
reductions: 4463
neighbours:
4) test Ruby.call macro (ExportRubyTest)
test/export_ruby_test.exs:28
** (ErlangError) Erlang error: {:port_closed, {:code, 1}}
code: result = pid |> Ruby.call(upcase("hello"), from_file: "test")
stacktrace:
(erlport) /export/home/jose/export/deps/erlport/src/erlport.erl:234: :erlport.call/3
test/export_ruby_test.exs:30: (test)
....
Finished in 0.5 seconds
8 tests, 4 failures
Randomized with seed 743063
System Information
Centos 7 x64
Ruby: ruby 2.0.0p648 (2015-12-16) [x86_64-linux]
Python: Python 3.6.6
I installed both Ruby and Python via the terminal using yum install python ruby
It seems to be complaining about a ruby gem of some kind but it's not available in rubygems website so I have no idea what its looking for. Anyone have an idea?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.