[wxPython-users] How to open an explorer window?
Phil Mayes
phil at philmayes.com
Wed Aug 1 15:48:17 PDT 2007
At 01:41 PM 8/1/2007, Robin Dunn wrote:
>Phil Mayes wrote:
>>The only way I could find needed to hardwire the location of explorer :-(
>
>You can either count on it being on the PATH, or you can use
>os.environ['SystemRoot'] to find out the name of the dir it is located in.
Oh, tapping the environment is cool, thanks! Relying on PATH didn't work
for me, though:
os.spawnl(os.P_NOWAIT, 'explorer.exe', ...
gave me:
<type 'exceptions.OSError'> [Errno 2] No such file or directory
I switched to Mike Driscoll's suggestion, which didn't need a path:
subprocess.Popen('explorer /n,/e,/select,"%s"'%utils.GetRootPath())
(My environment: XP not SP2, Python 2.5.1, wx 2.8.4.0)
Phil
More information about the wxpython-users
mailing list