pythonsymbianpys60

Symbian app on Python note usage


When I try to use this command

appuifw.note(u"Connecting to %s" % (address), "conf");

I'm getting error: "not all arguments converted during string formatting"

How to fix this error?


Solution

  • The error you mentioned arise in cases like

    >>> print "my name is %s" %('foo','bar')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    TypeError: not all arguments converted during string formatting
    

    It means I have 2 values to replace ('foo', 'bar') but only provided one place holder (%s).

    To correct it

    >>> print "my name is %s %s" %('foo','bar')
        my name is foo bar
    

    There is also a another way to achieve this using str.format().

    >>> print "my name is {0} {1}".format('foo','bar')
        my name is foo bar