Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0
redstorm64

Run program from within a program

Question

I'm wondering how to call a program from within another program and pass it arguments.  I've gotten close by using the "shell.execute()" command but once it get into the 2nd program it get's a bit unhappy...   It doesn't like that I'm "requiring" things at again in the 2nd program...  Is there another command I should be using instead of "shell.execute()"?

 

Here is how I'm using it currently:

shell.execute("prgm_name",{arg1,arg2})
Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0
  • Solution

Your problem is is that the second argument to shell.execute is the environment to run the program in. You are probably looking for os.execute, which doesn't pull shenanigans like this. You give os.execute one string, which is the program name followed by the arguments, the same as in the shell.

os.execute("prgm_name arg1 arg2")
Link to post
Share on other sites
  • 0

 

Your problem is is that the second argument to shell.execute is the environment to run the program in. You are probably looking for os.execute, which doesn't pull shenanigans like this. You give os.execute one string, which is the program name followed by the arguments, the same as in the shell.

os.execute("prgm_name arg1 arg2")

 

Exactly what I was looking for.  Program is working great now, thank you!    :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.