os.startfile() - one or two arguments?

Tim Golden tim.golden at viacom-outdoor.co.uk
Fri Apr 28 11:15:26 EDT 2006


[BartlebyScrivener]

| Can any Windows user give a working example of adding a "command verb"
| to os.startfile()?

I'm afraid the core Python version of this
command has only grown the command verb
since 2.5a1.

Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.startfile ("c:/temp.txt", "print")
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: startfile() takes exactly 1 argument (2 given)
>>>
>>>

But

Python 2.5a1 (r25a1:43589, Apr  5 2006, 10:36:43) [MSC v.1310 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.startfile ("c:/temp.txt", "print")
>>>

You can, however, use the pywin32 extensions in any version.
For example:

http://timgolden.me.uk/python/win32_how_do_i/print.html#shellexecute

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________



More information about the Python-list mailing list