Search code examples
python-3.xpraw

Python Praw TypeError: not all arguments converted during string formatting


I wasn't getting this message when I was running the script earlier...and now I am. What am I missing?

comments.reply("__%s__","\n","Current Temp: %s\u00b0F" % (str(cityname),temp_f))

Solution

  • The problem is at the third string:

    "Current Temp: %s\u00b0F" % (str(cityname),temp_f)
    

    It contains only one format specifier %s but a 2-tuple as formatting arguments. Hence not all arguments can be converted during the formatting. On the other hand your first string __%s__ goes unformatted, so I have the feeling that you rather want do combine these three strings either (e.g. by leaving out the commas):

    comments.reply("__%s__\nCurrent Temp: %s\u00b0F" % (cityname, temp_f))