[erlang-questions] Cannot start my application inside an escript ¡¡SOLVED!! (shame on me)

Angel J. Alvarez Miguel <>
Mon Apr 30 13:27:43 CEST 2012

My app name was wrong being nosehoover instead of nosehover....

Silly mistake



We are developing a molecular dynamics simulator in erlang so we have create 
an app structure of dirs 
and compile and bundle everything with rebar...


We currently hook all functionality into the main() function on nosehoover.erl 
that escripts calls and this runs fine.

Now we want to leave only cmdline args procesing to the main function and 
start a full blown erlang app
creating worker and supervisors so first we are trying to start a minimal 

################### nosehoover.erl  (-compile(export_all))

main(Argumentos) ->
    ok                       = application:load(nosehoover),
    {ok,Version}             = application:get_key(nosehoover,vsn),
    {ok,Description}         = application:get_key(nosehoover,description),
    Programa                 = escript:script_name(),
   % print a welcome message..
    io:format("Erlang Nosehoover(~s): ~s\n\n\n",[Version,Description]),

   % look for cmdline specs exported by my modules
    OptionProviders          = 

    io:format("[ COMMAND LINE PARSING STAGE ]\nOptions providers found: ~w\n",

   % build a complete specs list for getopt
    {OptSpecList,OptFunList} = collect_option_providers(OptionProviders), 

    case parse_args(OptSpecList, Argumentos, OptFunList) of
    {ok, {Opciones, _OtrosArgs}} ->  % ok lets start the whole thing
	% try to start the application 
        ok = application:start(nosehover),  % <---------- THIS IS THE ERROR!!
	% current entry point as a plain script app
    {help} ->
        getopt:usage(OptSpecList, Programa);
    {version} ->
        io:format("~s (v ~s)\n~s\n", [Programa,Version,Description]);
    {error, {invalid_option_arg, Data}} ->
        io:format("Error:\n\t Invalid option: ~p~n~n", [Data]),
        getopt:usage(OptSpecList, Programa);
    {error, {Reason, Data}} ->
        io:format("Error:\n\t~s ~p~n~n", [Reason, Data]),
        getopt:usage(OptSpecList, Programa)

start(Type,Args) ->
   % just something to see if appp controller tried to start us...
   io:format("Application started (~w) with args:~p",[Type,Args]),


We use application controller to load the bundled nosehoover.app in order to 
ask for what 
modules the app has and thinks like this, and it seem it find the app file and 
can load our app description, but 
 whenever i try to start the application there is a error:

escript: exception error: no match of right hand side value 
                 {error,{"no such file or directory","nosehover.app"}}
  in function  nosehoover:main/1 (src/nosehoover.erl, line 103)
  in call from escript:run/2 (escript.erl, line 727)
  in call from escript:start/1 (escript.erl, line 277)
  in call from init:start_it/1 
  in call from init:start_em/1

Its seems app controller can locate the app file and we can interrogate about 
app properties , but then it is 
unable to use it just to start the application.

Have anyone tried this way of doing things (start as an escript, the load and 
start an app), is there some problem with the app controller
and zip bundled beams, or mybe escript zip files are no suitable for full 
erlangs apps? 

ZIP dir structure looks flat while is should retain the app form?

Thanks in advance....


 Angel J. Alvarez Miguel, Servicios Informáticos
 Edificio Torre de Control, Campus Externo UAH
 Alcalá de Henares 28806, Madrid    ** ESPAÑA **

-------------[taH pagh taHbe', DaH mu'tlheghvam vİqelnİS]--<<-

More information about the erlang-questions mailing list