title: Python: return output of ksh function
body: <p>On Unix, how can Iretrieve the output of a ksh function as a Python variable?
  The function is called <code>sset</code> and is defined in my ".kshrc". </p>
  
  <p>I tried using the <code>subparser</code> module according to comment recommendations. Here's what I came up with: </p>
  
  <pre><code>import shlex
  import subprocess
  
  command_line = "/bin/ksh -c \". /Home/user/.khsrc &amp;&amp; sset \""
  s = shlex.shlex(command_line)
  
  subprocess.call(list(s))
  </code></pre>
  
  <p>And I get a <code>Permission denied</code> error. Here's the traceback:</p>
  
  <pre><code>Traceback (most recent call last):
    File "./pymss_os.py", line 9, in &lt;module&gt;
      subprocess.call(list(s))
    File "/Soft/summit/tools/Python-2.7.2/Lib/subprocess.py", line 493, in call
      return Popen(*popenargs, **kwargs).wait()
    File "/Soft/summit/tools/Python-2.7.2/Lib/subprocess.py", line 679, in __init__
      errread, errwrite)
    File "/Soft/summit/tools/Python-2.7.2/Lib/subprocess.py", line 1228, in _execute_child
      raise child_exception
  OSError: [Errno 13] Permission denied
  </code></pre>
  
  <p>Extra details:</p>
  
  <ul>
  <li>Python 2.7</li>
  <li>Ksh Version M-11/16/88i</li>
  <li>Solaris 10 (SunOS 5.10)</li>
  </ul>