Embedding a executable inside Python Script

  • Thread starter Shankarjee Krishnamoorthi
  • Start date
S

Shankarjee Krishnamoorthi

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
 
G

Grant Edwards

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.
 
S

Shankarjee Krishnamoorthi

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

Shankarjee
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top