Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you can ship the command line tool with your application, and if only your application will be using it (instead of the tool being used directly by the user), you can directly include and use the command line tool with your application like so:</p> <ul> <li>Store the command line tool somewhere in your application directory.</li> <li>Set the Python module search path so that it looks for the module you need.</li> </ul> <p>Setting the Python module search path <em>relative to a Python program</em> can be done with</p> <pre><code>import sys import os.path as path sys.path.append(path.join(path.dirname(__file__), '&lt;relative path between this program and the command line tool module&gt;')) import &lt;command line tool module&gt; </code></pre> <p>The relative path can be written with the <code>..</code> parent directory convention: this works both on Unix (including Mac OS X) and Windows.</p> <p><strong>PS</strong>: If many programs need to access the command line tool module, you can:</p> <ul> <li><p>Either put the above code in each of your programs,</p></li> <li><p>or, if you want something easier to maintain, you can create your own module <code>my_runner</code> and use it as a proxy: your module <code>my_runner</code> would import all the original <code>runner</code> functions like so:</p> <blockquote> <pre><code>import sys import os.path as path sys.path.append(path.join(path.dirname(__file__), '&lt;relative path between this program and the original ino module&gt;')) from ino.runner import * </code></pre> </blockquote> <p>You can then use the original runner module in all your programs through your proxy, by simply doing "normal" imports of your own <code>my_runner</code>module:</p> <blockquote> <pre><code>from my_runner import main </code></pre> </blockquote></li> </ul> <p><strong>PPS</strong>: If you want a more robust path that works even if the working directory later changes, it is possible to convert a potentially local path to an absolute path with: <code>path.join(path.abspath(path.dirname(__file__)),…</code>.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload