Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Double digit args prefix not passing properly #280

Open
baagiiSW opened this issue Jan 6, 2023 · 0 comments
Open

Double digit args prefix not passing properly #280

baagiiSW opened this issue Jan 6, 2023 · 0 comments
Labels

Comments

@baagiiSW
Copy link

baagiiSW commented Jan 6, 2023

Describe the bug
Due to logic and variable number using double prefix args (--lt, --ed etc) is required.

Python code
`
parser = ArgumentParser()
parser.add_argument(
"--es",
type = float,
dest = "e_start",
action="append",
required = True,
help = "e_start"
)

parser.add_argument(
"--ee",
type = float,
dest = "e_end",
action="append",
required = True,
help = "e_end"
)

parser.add_argument(
"--eu",
type = float,
dest = "e_suitei",
action="append",
required = True,
help = "e_suitei"
)
`

Javascript code

return new Promise(async (resolve, reject) => { let arg = []; stations.forEach(st => { arg.push(--es${st.es}); arg.push(--ee${st.ee}); arg.push(--eu${st.eu}`);

  });

  let options = {
    mode: 'text',
    pythonOptions: ['-u'],
    scriptPath: `${PROJECT_DIR}/src/scripts/algorithm`,
    args: arg,
  };

}`

Expected behavior
Run the python script by given args

Actual behavior

PythonShellError: usage: *.py [-h] --ee LAT --es LON --eu N
0|index |
0|index | lagrange.py: error: the following arguments are required: --es, --ee, --eu
0|index | at PythonShell.parseError (/workspace/node_modules/python-shell/index.js:268:21)
0|index | at terminateIfNeeded (/workspace/node_modules/python-shell/index.js:139:32)
0|index | at ChildProcess. (/workspace/node_modules/python-shell/index.js:131:13)
0|index | at ChildProcess.emit (node:events:513:28)
0|index | at ChildProcess._handle.onexit (node:internal/child_process:291:12) {
0|index | executable: 'python3',
0|index | options: [ '-u' ],
0|index | script: '/workspace/src/scripts/algorithm/lagrange.py',
0|index | args: [
0|index | '--ee 35.96691467421596',
0|index | '--es 140.0746095366776',
0|index | '--eu 36.1061130',

Other Information (please complete the following information):

  • OS: [e.g. Windows10]
  • Python Version [e.g. 3.6]
  • Node Version [e.g. 12]

Additional context

Data validity or why using args with double-digit naming such a small number of inputs is not essential. The above is only for reproducing the error. The actual code and log are too long.

When using single digit args -e instead of --ee, there is no issue.

@baagiiSW baagiiSW added the bug label Jan 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant