Latest recipes tagged "executable"http://code.activestate.com/recipes/tags/executable/new/2015-03-03T10:47:32-08:00ActiveState Code RecipesDrop a minimal, valid Windows executable file to disk, for testing (Python) 2015-03-03T10:47:32-08:00Simon Harrisonhttp://code.activestate.com/recipes/users/4191738/http://code.activestate.com/recipes/579029-drop-a-minimal-valid-windows-executable-file-to-di/ <p style="color: grey"> Python recipe 579029 by <a href="/recipes/users/4191738/">Simon Harrison</a> (<a href="/recipes/tags/executable/">executable</a>, <a href="/recipes/tags/pe/">pe</a>, <a href="/recipes/tags/windows/">windows</a>). Revision 3. </p> <p>Sometimes I need to create a valid windows executable file from a Python script for the sake of running a test.</p> Adding the directory of the python executable to the system PATH under windows (Python) 2010-05-19T19:01:31-07:00Anthon van der Neuthttp://code.activestate.com/recipes/users/2403822/http://code.activestate.com/recipes/577233-adding-the-directory-of-the-python-executable-to-t/ <p style="color: grey"> Python recipe 577233 by <a href="/recipes/users/2403822/">Anthon van der Neut</a> (<a href="/recipes/tags/environment/">environment</a>, <a href="/recipes/tags/executable/">executable</a>, <a href="/recipes/tags/path/">path</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/variable/">variable</a>). </p> <p>If you install python under windows and then open a command shell (DOS-prompt, you normally get an error message if you type "python" at the prompt. This is because the directory of the python executable is not in the PATH environment variable. If you know where you installed python, you can add this via Control Panel -> System -> Advanced -> Environment Variables but this is not very user friendly way of doing things and error prone.</p> <p>This program, if run by double clicking the file or by dragging the file to a command shell, will add the directory of the executable associated with the .py extension to the PATH env. var (if it is not already in there). It will notify other programs of this change, but unfortunately <a href="http://command.com" rel="nofollow">command.com</a> is not smart enough to understand that. You have to open a new command shell after running the program in order to be able to run "python" at the dos prompt.</p> <p>If run with the optional command line parameter 'remove' the directory will be removed from the PATH.</p>