#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    17
    Rep Power
    0

    Executing py scripts from separate directories with an exe


    Hey so my directory structure currently looks like this:

    Code:
    main
    ---folder1
    -------one.py
    ---folder2
    -------two.py
    I would like to create an exe inside the main folder that runs one.py and then two.py so that when I hand over my main folder to someone who doesn't have python installed, they can just click on the exe file. Also inside folder1 and folder2 are some py scripts which are related respectively to one.py and two.py
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,711
    Rep Power
    480
    A batch script, rather than a .exe is more likely to be appropriate.
    Also, they'll need python installed to use the .py files.

    Do you want the batch script to install python if python is not installed?

    I suggest asking this question in the
    http://forums.devshed.com/windows-help-34/
    forum. I'd tell you to install cygwin and show you a bash script. I suppose the DOS script, without checking for python installation, would look something like

    cd folder1
    start python one.py
    cd ..\folder2
    start python two.py

    or you'd use start idle instead of start python
    I can say I that I don't know how to run non-gui jobs in the background in DOS. I expect it's learnable. Learnable? Learnable.
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2008
    Posts
    17
    Rep Power
    0
    Ok thanks, is it not possible to compile the scripts inside folder1 and folder2 to an exe so that a Python installation is not required?
  6. #4
  7. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,711
    Rep Power
    480
    I hate to hear impossible---unless it involves backward time travel. (OK, a particle with imaginary mass (a neutrino?) can travel in time. It doesn't end up here, though. It ends up there.)

    I searched the internet as you could have:

    http://www.logix4u.net/component/content/article/27-tutorials/44-how-to-create-windows-executable-exe-from-python-script
    [code]Code tags[/code] are essential for python code and Makefiles!

IMN logo majestic logo threadwatch logo seochat tools logo