[Tutor] What does "TypeError: 'int' object is not iterable" mean?
Eloy Zuniga Jr.
eloyz.email at gmail.com
Thu Oct 21 15:09:16 CEST 2010
Forget what I said. Tim's right.
Return an iterable from within your method not an integer.
On Thu, Oct 21, 2010 at 7:52 AM, Tim Golden <mail at timgolden.me.uk> wrote:
> On 21/10/2010 13:42, Richard D. Moores wrote:
>
>> Traceback (most recent call last):
>> File "c:\P26Working\test_urllib2_21a.py", line 148, in<module>
>> unchanged_count, higher_count, lower_count, secs =
>> sleep_seconds_control(unchanged_count, higher_count, lower_count,
>> secs)
>> TypeError: 'int' object is not iterable
>>
>> I'm working on a script that keeps track of the USD -> Japanese Yen
>> exchange rate. I'm experimenting with adding functionality that
>> changes the seconds to sleep between web scrapes, depending on
>> consecutive outputs of no change in the exchange rate. Please see the
>> code at<http://tutoree7.pastebin.com/KWmdk8jb>
>>
>
> sleep_seconds_control is returning an integer.
>
> You're trying to assign that integer to the four names:
>
> unchanged_count, higher_count, lower_count, secs
>
> Python therefore tries to iterate over the integer to
> allocate one item to each of the four name.
>
> And it can't. Because it's an integer
>
> TJG
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
--
Eloy Zuniga Jr.
www.eloyz.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101021/6768e11e/attachment-0001.html>
More information about the Tutor
mailing list