Double digit args prefix not passing properly
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.
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.