Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Although the question is: <em>How do I get control early enough to issue an error message <strong>and exit</strong>?</em></p> <p>The question that I answer is: <em>How do I get control early enough to issue an error message <strong>before starting the app</em></strong>?</p> <p>I can answer it a lot differently then the other posts. Seems answers so far are trying to solve your question from within Python.</p> <p>I say, do version checking before launching Python. I see your path is Linux or unix. However I can only offer you a Windows script. I image adapting it to linux scripting syntax wouldn't be too hard.</p> <p>Here is the DOS script with version 2.7:</p> <pre><code>@ECHO OFF REM see http://ss64.com/nt/for_f.html FOR /F "tokens=1,2" %%G IN ('"python.exe -V 2&gt;&amp;1"') DO ECHO %%H | find "2.7" &gt; Nul IF NOT ErrorLevel 1 GOTO Python27 ECHO must use python2.7 or greater GOTO EOF :Python27 python.exe tern.py GOTO EOF :EOF </code></pre> <p>This does not run any part of your application and therefore will not raise a Python Exception. It does not create any temp file or add any OS environment variables. And it doesn't end your app to an exception due to different version syntax rules. That's three less possible security points of access.</p> <p>The <code>FOR /F</code> line is the key.</p> <pre><code>FOR /F "tokens=1,2" %%G IN ('"python.exe -V 2&gt;&amp;1"') DO ECHO %%H | find "2.7" &gt; Nul </code></pre> <p>For multiple python version check check out url: <a href="http://www.fpschultze.de/modules/smartfaq/faq.php?faqid=17" rel="nofollow noreferrer">http://www.fpschultze.de/modules/smartfaq/faq.php?faqid=17</a></p> <p>And my hack version:</p> <p>[MS script; Python version check prelaunch of Python module] <a href="http://pastebin.com/aAuJ91FQ" rel="nofollow noreferrer">http://pastebin.com/aAuJ91FQ</a></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. 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