title: Passing arguments by running a python script to a jar
body: <p>I have a simple Java app that does an addition by passing 2 arguments when running it. Here is the code:</p>
  <pre><code>package test_python;
  
  import java.util.concurrent.TimeUnit;
  
  
  public class Test_python {
  
  public int addition(int first, int second) {
  return first + second;
  }
  public static void main(String[] args) {
      
  Test_python a = new Test_python();
  System.out.println(a.addition(Integer.parseInt(args[0]), Integer.parseInt(args[1])));
  
   
  
  }
  
  }
  </code></pre>
  <p>And I have a python script :</p>
  <pre><code>import subprocess
  import sys
  
  
  first_arg = subprocess.check_output([sys.argv])
  second_arg = subprocess.check_output([sys.argv])
  subprocess.call(['java', '-jar', 'test_python.jar ',first_arg,second_arg])
  </code></pre>
  <p>I would like to pass two arguments like 2 and 3 to the python script and the to send the arguments to the jar and return the response. I get this error when I try:</p>
  <pre><code>Traceback (most recent call last):
  File &quot;C:\Certificat python\start-stop.py&quot;, line 5, in &lt;module&gt;
  first_arg = subprocess.check_output([sys.argv])
  File &quot;C:\Users\40723\AppData\Local\Programs\Python\Python39\lib\subprocess.py&quot;, line 
  424, in check_output
  return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File &quot;C:\Users\40723\AppData\Local\Programs\Python\Python39\lib\subprocess.py&quot;, line 
  505, in run
  with Popen(*popenargs, **kwargs) as process:
  File &quot;C:\Users\40723\AppData\Local\Programs\Python\Python39\lib\subprocess.py&quot;, line 
  951, in __init__
  self._execute_child(args, executable, preexec_fn, close_fds,
  File &quot;C:\Users\40723\AppData\Local\Programs\Python\Python39\lib\subprocess.py&quot;, line 
  1360, in _execute_child
  args = list2cmdline(args)
  File &quot;C:\Users\40723\AppData\Local\Programs\Python\Python39\lib\subprocess.py&quot;, line 
  565, in list2cmdline
  for arg in map(os.fsdecode, seq):
  File &quot;C:\Users\40723\AppData\Local\Programs\Python\Python39\lib\os.py&quot;, line 822, in 
  fsdecode
  filename = fspath(filename)  # Does type-checking of `filename`.
  TypeError: expected str, bytes or os.PathLike object, not list
  </code></pre>
  <p>Can you please give me a solution ?</p>
  <p>Thanks in advance</p>