Launch file based on association
Chris Cioffi
evenprimes at gmail.com
Mon Jan 23 09:35:59 EST 2006
Q: If I have a file called "spreadsheet.xls" how can I launch it in what
ever program it is associated with? I don't care if that program is Excel
or OpenOffice Calc. I just want to launch the file.
Since I want to just launch the new process, naturally I looked at os.execl().
However, I can't figure out how to make it work:
>>> import os
>>> os.execl("c:\\spreadsheet.xls")
Traceback (most recent call last):
File "<input>", line 1, in ?
File "C:\Python24\lib\os.py", line 309, in execl
execv(file, args)
OSError: [Errno 8] Exec format error
>>> os.execl("c:\\spreadsheet.xls", "c:\\spreadsheet.xls")
Traceback (most recent call last):
File "<input>", line 1, in ?
File "C:\Python24\lib\os.py", line 309, in execl
execv(file, args)
OSError: [Errno 8] Exec format error
Is there some trick? I _think_ I'm doing what the docs desribe...
I've tried to Google around and I can't find anything of use. Having said
that, I'd really appreciate it if someone could give me the right 2 word
Google search that pops up exactly what I'm looking for. ;->
Thanks!
Chris
--
"A little government and a little luck are necessary in life, but only a
fool trusts either of them." -- P. J. O'Rourke
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060123/390ddf8a/attachment.html>
More information about the Python-list
mailing list