The only way I could find needed to hardwire the location of explorer 
EXPLORER = 'C:\\windows\\explorer.exe'
os.spawnl(os.P_NOWAIT, EXPLORER, '.', '/n,/e,/select,"%s"'%mydir)
See http://support.microsoft.com/default.aspx?scid=314853
If anyone knows a cleaner way, I'd love to hear it!
Phil
路路路
At 02:51 PM 7/31/2007, you wrote:
Hi,
I currently use wxPython on windows. Is there a way to make an explorer window open up, displaying the directory that contains a file? For example, if I have the path "C:\myfolder\subfolder\file.txt", I want to pass this path into a function that opens up an explorer window at the folder "C:\myfolder\subfolder\" with the file " file.txt" highlighted. Is this possible? I'm not sure if this is a wxPython ability or if the python libraries support this.
Thanks.
Hi
have you tried a wx.GenericDirCtrl widget?
http://www.wxpython.org/docs/api/wx.GenericDirCtrl-class.html
There is an example of this included with the wxPython demo file
Alun Griffiths
路路路
At 09:04 01/08/2007, you wrote:
Or you can use the win32api library!
Phil Mayes ha scritto:
At 02:51 PM 7/31/2007, you wrote:
Hi,
I currently use wxPython on windows. Is there a way to make an explorer window open up, displaying the directory that contains a file? For example, if I have the path "C:\myfolder\subfolder\file.txt", I want to pass this path into a function that opens up an explorer window at the folder "C:\myfolder\subfolder\" with the file " file.txt" highlighted. Is this possible? I'm not sure if this is a wxPython ability or if the python libraries support this.
Thanks.
The only way I could find needed to hardwire the location of explorer 
EXPLORER = 'C:\\windows\\explorer.exe'
os.spawnl(os.P_NOWAIT, EXPLORER, '.', '/n,/e,/select,"%s"'%mydir)
See http://support.microsoft.com/default.aspx?scid=314853
If anyone knows a cleaner way, I'd love to hear it!
Phil
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
--
/\/\ariano Di Felice
Java PHP Python Ruby programmer
with MySQL, PostgreSql, SQLite and Oracle support
Linux Platform Developer
http://www.marianodifelice.it
mariano.difelice@gmail.com
Tel. 0735 703735
Cell +39 339 6407211
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
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.
路路路
On 8/1/07, Phil Mayes <phil@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