[Tutor] question about type str

Python python at venix.com
Sat Jul 29 16:44:17 CEST 2006


On Sat, 2006-07-29 at 09:26 -0500, shawn bright wrote:
> Hey there,
> i have an app with this line.....
> sys.stderr.write("GET DATA %s %d %d\n" (sound, time_limit, digit_count))

sys.stderr.write("GET DATA %s %d %d\n" % (sound, time_limit, digit_count))
                                   ----^----
You meant to do string interpolation, but left out the interpolation
(formating) operator.  So the parenthesized expression looked like a
function call.

> 
> it is failing with the following error.
> 
> Traceback (most recent call last): 
>   File "/usr/share/asterisk/agi-bin/ast_agi_test.agi", line 88, in ?
>     entered_digits = getNumber(welcome, time_limit, password_digits)
>   File "/usr/share/asterisk/agi-bin/ast_agi_test.agi", line 72, in
> getNumber 
>     sys.stderr.write("GET DATA %s %d %d\n" (sound, time_limit,
> digit_count))
> TypeError: 'str' object is not callable
> 
> 
> anyone know what i may be doing wrong here?
> 
> thanks
> shawn
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-- 
Lloyd Kvam
Venix Corp



More information about the Tutor mailing list