os.startfile() - one or two arguments?

Lou Losee llosee at gmail.com
Fri Apr 28 11:14:48 EDT 2006


On 28 Apr 2006 08:06:02 -0700, BartlebyScrivener <rpdooling at gmail.com>
wrote:
>
> Can any Windows user give a working example of adding a "command verb"
> to os.startfile()?
>
> When I try it, it squawks that it takes only one argument.
>
> >>> os.startfile('d:/','explore')


ry:
os.startfile(["d:/",  "explore"])

you want a list for the args

Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> TypeError: startfile() takes exactly 1 argument (2 given)
>
> from os module
>
> startfile(      path[, operation])
>     Start a file with its associated application.
>
>     When operation is not specified or 'open', this acts like
> double-clicking the file in Windows Explorer, or giving the file name
> as an argument to the start command from the interactive command shell:
> the file is opened with whatever application (if any) its extension is
> associated.
>
>     When another operation is given, it must be a ``command verb'' that
> specifies what should be done with the file. Common verbs documented by
> Microsoft are 'print' and 'edit' (to be used on files) as well as
> 'explore' and 'find' (to be used on directories).
>
> Thanks,
>
> rpd
>
> "Give a man a fire and keep him warm for a day. Light a man on fire and
> he will be warm for rest of his life." --Terry Pratchett
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060428/49eacaa5/attachment.html>


More information about the Python-list mailing list