How to open an explorer window?
Steve Holden
steve at holdenweb.com
Thu Aug 2 06:39:57 PDT 2007
Chris Mellon wrote:
> On 8/1/07, Phil Mayes <phil at philmayes.com> wrote:
>> 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
>>
>
> os.spawn must not use the same win32 apis that subprocess does. I'd
> have to dig through MSDN to check but I know there's one that creates
> a process from a direct path to an executable image, and another that
> uses all the standard path resolution. subprocess is generally to be
> preferred over os.spawn and friends for all but the most specialized
> of uses, though.
IIRC the path-based variants aren't available in the Windows environment.
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
More information about the wxpython-users
mailing list