Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8954897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:25:02+00:00 2026-06-15T14:25:02+00:00

Using Windows 7 + python 2.6, I am trying to run a simulation model

  • 0

Using Windows 7 + python 2.6, I am trying to run a simulation model in parallel. I can launch multiple instances of the executable by double-clicking on them in my file browser. However, asynchronous calls with Popen result in each successive instance interrupting the previous one. For what it’s worth, the executable returns text to the console, but I don’t need to collect results interactively.

Here’s where I am so far:

import multiprocessing, subprocess

def run(c):
    exe = os.path.join("<location>","folder",str(c),"program.exe")
    run = os.path.join("<location>","folder",str(c),"run.dat")
    subprocess.Popen([exe,run],creationflags = subprocess.CREATE_NEW_CONSOLE)

def main():
    pool = multiprocessing.Pool(3)
    for c in range(10):
        pool.apply_async(run,(str(c),))
 pool.close()
 pool.join()

if __name__ == '__main__':
    main()

After scouring SO for a solution, I’ve learned that using multiprocessing may be redundant, but I need some way to limit the number of cores working.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:25:04+00:00Added an answer on June 15, 2026 at 2:25 pm

    Enabled by @J.F. Sebastian’s comment regarding the cwd argument.

    import multiprocessing, subprocess
    
    def run(c):
        exe = os.path.join("<location>","folder",str(c),"program.exe")
        run = os.path.join("<location>","folder",str(c),"run.dat")
        subprocess.check_call([exe,run],cwd=os.path.join("<location>","folder"),creationflags = subprocess.CREATE_NEW_CONSOLE)
    
    def main():
        pool = multiprocessing.Pool(3)
        for c in range(10):
            pool.apply_async(run,(str(c),))
        pool.close()
        pool.join()
    
    if __name__ == '__main__':
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to make a simple hello-world executable python gui app in windows using
Alright so using Python with windows I am trying to run a batch command
I'm using Python 2.7.3 on Windows XP via the IDLE GUI, and I'm trying
How can I write to files using Python (on Windows) and use the Unix
I'm trying to create a custom TCP stack using Python 2.6.5 on Windows 7
I'm trying to run a python file using Notepad++'s NppExec plugin. My file attempts
I'm new to Python. I'm trying to run this script (gencards.py) in Windows, but
I'm using python 3.2.2 on windows 7 and I'm trying to create a program
I'm using python 3.3.0 in windows 8. This is the code which I'm trying
I am trying to run this python script called fselect in windows 7. It

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.