Skip to content

First argument parsed incorrectly #117

Open
@cirobr

Description

@cirobr

Consider the following code, written on a Jupyter notebook:

using ArgParse

function parse_commandline()
    s = ArgParseSettings()
    @add_arg_table s begin
        "arg1"
            help     = "learning rate"
            default  = 0.001

        "arg2"
            help     = "minibatch size for dataloader"
            default  = 1

        "arg3"
            help     = "number of epochs"
            default  = 10
    end

    return parse_args(ARGS, s)
end

parsed_args = parse_commandline()

When executed correctly, it gives the following reply:

Dict{String, Any} with 3 entries:
  "arg1" => 0.001
  "arg2" => 1
  "arg3" => 10

I have two computers running latest Ubuntu 20.04 and Julia 1.6.7, presenting very adverse results:

  • On REPL, both execute the code correctly;
  • On VS-Code, PC-A runs the code correctly, but PC-B does not;
  • On Anaconda Jupyter, PC-B runs the code with failure, whilst PC-A does not.

Whenever failure occurs, output is as follows:

Dict{String, Any} with 3 entries:
  "arg1" => "/home/myuser/.local/share/jupyter/runtime/kernel-v2-1571XvxDGHmL0T9W…
  "arg2" => 1
  "arg3" => 10

Despite extensive effort, could not find the cause and fix it.

Any advise is appreciated. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions