<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">I'm getting weird error message when calling my escript from within a Python script</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">escript: exception error: undefined function getopt:parse/2</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div></blockquote><div class="">From the shell a standalone script works just fine... any idea ?</div><div class=""><br class=""></div><div class="">This is how I generate the escripted version of myapp :</div><div class=""><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div class=""><div class="">#!/usr/bin/env escript</div><div class="">%% -*- erlang -*-</div><div class="">%%! -smp enable -sname make_myapp</div><div class="">main(_) -><span class="Apple-tab-span" style="white-space:pre"> </span>{ok, SourceCode} = file:read_file("myapp.erl"),</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{ok, _, BeamCode} = compile:file("myapp.erl", [binary, debug_info]),</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{ok, _, GetOpt} = compile:file("getopt.erl", [binary, debug_info]),</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>escript:create("myapp", [shebang, {archive, [</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{"myapp.erl", SourceCode},</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{"myapp.beam", BeamCode},</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>{"getopt.beam",GetOpt}],</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>[]}</div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span>]).</div></div><div class=""><br class=""></div></blockquote><div class="">Thanks in advance</div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Oct 11, 2015, at 5:40 AM, Dmitry Kolesnikov <<a href="mailto:dmkolesnikov@gmail.com" class="">dmkolesnikov@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">And if you are using rebar and you have deps to other projects you might add following lines to rebar.config</div><div class=""><pre class=""><font face="UICTFontTextStyleTallBody" class=""><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);" class="">{escript_incl_apps, [ getopt
]}.</span></font></pre><pre class=""><font face="UICTFontTextStyleTallBody" class=""><span style="white-space: normal; background-color: rgba(255, 255, 255, 0);" class=""> {escript_emu_args, "%%! +K true +P 10000000\n"}.</span></font></pre></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class="">Sad story, I've not figure out how to add erlang runtime to same package. Anyone, who receives you script needs to have one.</span></div><div class=""><span style="background-color: rgba(255, 255, 255, 0);" class=""><br class=""></span></div><div class="">Best Regards,<div class="">Dmitry</div><div class="">>-|-|-(*></div></div><div class=""><div class=""><br class=""></div>On 11 Oct 2015, at 08:46, Frederic BONFANTI <<a href="mailto:frederic.bonfanti@gmail.com" class="">frederic.bonfanti@gmail.com</a>> wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><span class="">Hi guys,</span><br class=""><span class=""></span><br class=""><span class="">given a simple Erlang code that consists in one file, let’s say test123.erl , I’d like to </span><br class=""><span class=""></span><br class=""><span class="">1. use a Makefile to compile test123.erl into test.beam and then generate a distributable version of test123 (executable)</span><br class=""><span class=""></span><br class=""><span class="">2. figure-out how to parse the command line arguments once this test command is called from regular shell, for example:</span><br class=""><span class=""> </span><br class=""><span class=""> test123 -A -x 555</span><br class=""><span class=""></span><br class=""><span class="">If there are straightforward examples available, that will do.</span><br class=""><span class=""></span><br class=""><span class="">Thanks in advance</span><br class=""><span class=""></span><br class=""><span class="">_______________________________________________</span><br class=""><span class="">erlang-questions mailing list</span><br class=""><span class=""><a href="mailto:erlang-questions@erlang.org" class="">erlang-questions@erlang.org</a></span><br class=""><span class=""><a href="http://erlang.org/mailman/listinfo/erlang-questions" class="">http://erlang.org/mailman/listinfo/erlang-questions</a></span><br class=""></div></blockquote></div></div></blockquote></div><br class=""></div></body></html>