How to write a python function that ShellCommand, in the Lancent library, can execute?
<p><a href="https://github.com/ioam/lancet" rel="nofollow">Lancet</a> is a Python library to explore parameter spaces. It can launch jobs, organize the output, and dissect the results.</p>

<p>I'm having trouble getting the Quickstart example, in the documentation <a href="http://ioam.github.io/lancet/" rel="nofollow">here</a>, to run. This is the code:</p>

<pre><code>import lancet
example_name   = 'prime_quintuplet'
integers       = lancet.Range('integer', 100, 115, steps=16, fp_precision=0)
factor_cmd     = lancet.ShellCommand(executable='python factor.py', posargs=['integer'])
lancet.Launcher(example_name, integers, factor_cmd, output_directory='output')()
def load_factors(filename):
    "Return output of 'factor' command as dictionary of factors."
    with open(filename, 'r') as f:
        factor_list = f.read().replace(':', '').split()
    return dict(enumerate(int(el) for el in factor_list))

output_files   = lancet.FilePattern('filename', './output/*-prime*/streams/*.o*')
output_factors = lancet.FileInfo(output_files, 'filename',
                              lancet.CustomFile(metadata_fn=load_factors))
primes = sorted(factors[0] for factors in output_factors.specs
                                  if factors[0]==factors[1]) # i.e. if the input integer is the 1st factor
primes # A prime quintuplet, the closest admissable constellation of 5 primes.
</code></pre>

<p>I believe the problem is that I don't understand how the ShellCommand function works.</p>

<p>I tried writing a file named 'factor.py' and placing it in the same dirrectory as the Quickstart example.</p>

<pre><code>import argparse

def factor():
    ''' Returns an arbitrary list for testing. Not really a factor command'''
    parser = argparse.ArgumentParser()
    parser.add_argument("num1",help="Number to factor",type=int)
    args = parser.parse_args()
    return [args.num1, 2*args.num1, 1, 3]
</code></pre>

<p>I get the error:</p>

<pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'python factor.py'
</code></pre>

<p>Thrown on the line:</p>

<pre><code>lancet.Launcher(example_name, integers, factor_cmd, output_directory='output')()
</code></pre>

<p>I'm using Python 3.4.5 in a Jupyter notebook</p>

<p>Thanks in advance for any help!</p>

<p>I copied the example code and did not remember to change the executable name to an absolute path for factor.py.</p>

<p>On my computer it should be:</p>

<pre><code>factor_cmd     = lancet.ShellCommand(executable='/Users/klm/Devel/factor.py', posargs=['integer'])
</code></pre>

python