Question

I'm a windows user, and currently I have a simple script to launch all the programs I need while writing code.

Its called setup.py. This is just two programs that it opens...

import sys, string, os
os.chdir(r"C:\Program Files (x86)\Google\Chrome\Application")
os.startfile(r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe")
os.chdir(r"C:\Python27\Lib\idlelib")
os.startfile(r"C:\Python27\Lib\idlelib\idle.py")

When I run this program a shell window pops up, both Chrome and Idle launch, however the shell window stays open

When I exit the shell window (To make room in my task bar) Idle closes and chrome stays open. I would like both to stay open.

How can I do this?

EDIT This probably has to do with the extension type .exe vs .py.. still not sure how to go about this though

Not sure if the windows tag is relevant,. ask me to remove it and I will

Was it helpful?

Solution

You're right, it's the extension type. startfile operates like double-clicking a file in Windows explorer, so if you navigate to a Python file (.py) and double-click it, it launches the file and the console. If you want just the file, change it to:

os.startfile(r"C:\Python27\Lib\idlelib\idle.pyw")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top