Embedding a executable inside Python Script

Discussion in 'Python' started by Shankarjee Krishnamoorthi, Sep 19, 2007.

  1. Hi
    I have a python routine which calls an executable file created by
    someone else (I dont have the source code. All I have is an exe file).
    I do

    # My Python Code
    output = os.system('other_executable.exe')
    # Rest of my program.

    I need to give this routine to others to use it. I have a exe made
    with py2exe for my Python routine. The issue I am running into is
    this. All the exes (mycode.exe and other_executable.exe) are placed in
    a Network drive(Say I:) so that people can access it.

    When the user calls this from a Local Drice(Say C:) The output is like this
    C:> I:\mycode.exe input_file
    other_executable_file.exe is not found.....

    Is there any way where I can circumvent this. Thanks

    Shankarjee
    Shankarjee Krishnamoorthi, Sep 19, 2007
    #1
    1. Advertising

  2. On 2007-09-19, Shankarjee Krishnamoorthi <> wrote:

    > I have a exe made with py2exe for my Python routine. The issue
    > I am running into is this. All the exes (mycode.exe and
    > other_executable.exe) are placed in a Network drive(Say I:) so
    > that people can access it.
    >
    > When the user calls this from a Local Drice(Say C:) The output is like this
    > C:> I:\mycode.exe input_file other_executable_file.exe is not found.....


    The problem is that 'other_executable.exe' isn't in a directory
    that's on the current PATH.

    > Is there any way where I can circumvent this. Thanks


    Either set the PATH environment variable to include the
    directory where other_executable.exe is located or specify the
    complete path to other_executable.exe in your os.system() call.

    --
    Grant Edwards grante Yow! I hope the
    at ``Eurythmics'' practice
    visi.com birth control ...
    Grant Edwards, Sep 19, 2007
    #2
    1. Advertising

  3. I missed the obvious fact there. Thanks. I added it to the PATH and
    that fixed everything.

    Shankarjee

    On 9/19/07, Grant Edwards <> wrote:
    > On 2007-09-19, Shankarjee Krishnamoorthi <> wrote:
    >
    > > I have a exe made with py2exe for my Python routine. The issue
    > > I am running into is this. All the exes (mycode.exe and
    > > other_executable.exe) are placed in a Network drive(Say I:) so
    > > that people can access it.
    > >
    > > When the user calls this from a Local Drice(Say C:) The output is like this
    > > C:> I:\mycode.exe input_file other_executable_file.exe is not found.....

    >
    > The problem is that 'other_executable.exe' isn't in a directory
    > that's on the current PATH.
    >
    > > Is there any way where I can circumvent this. Thanks

    >
    > Either set the PATH environment variable to include the
    > directory where other_executable.exe is located or specify the
    > complete path to other_executable.exe in your os.system() call.
    >
    > --
    > Grant Edwards grante Yow! I hope the
    > at ``Eurythmics'' practice
    > visi.com birth control ...
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
    Shankarjee Krishnamoorthi, Sep 19, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. nico
    Replies:
    1
    Views:
    307
    Dennis Reinhardt
    Jul 1, 2004
  2. Avi Kak
    Replies:
    5
    Views:
    505
    Anthra Norell
    Jul 18, 2006
  3. Replies:
    15
    Views:
    475
    Dave Thompson
    Aug 21, 2006
  4. pratap
    Replies:
    20
    Views:
    746
    Flash Gordon
    Mar 7, 2007
  5. Jason Cavett
    Replies:
    8
    Views:
    606
    Sanjay
    May 16, 2007
Loading...

Share This Page