Help with Popen in 2.2
Lowel Stern
ls2311 at netcom.com
Tue Jul 9 01:03:30 EDT 2002
On Mon, 08 Jul 2002 23:25:45 -0400, Peter Hansen <peter at engcorp.com>
wrote:
>Lowel Stern wrote:
>>
>> >Do you know about the % operator?
>> >
>> Yes I do.
>
>But not how to use it properly... <wink>
>
>> You will find that if you use the %s with the popen command you get an
>> error:
>> TypeError: unsupported operand type(s) for %: 'file' and 'str'
>
>Please post the code that generates this message. The code
>_can_ be fixed.
>
>-Peter
--------------------------------------
import os
key = "%s %s" % ('"stern:STWA"',"1234")
print key
fp = os.popen('C:\python_scripts\prog %s') % (key)
---------------------------------------
fp = os.popen('C:\python_scripts\prog %s') % (key)
Traceback (most recent call last):
File "<pyshell#6>", line 1, in ?
fp = os.popen('C:\python_scripts\prog %s') % (key)
TypeError: unsupported operand type(s) for %: 'file' and 'str'
More information about the Python-list
mailing list