Ah I think I just got it...its probably this line?

target.write('%s' % (print_words))

print_words is a function you defined. You are trying to string format a
function object. It is trying to treat it like an iterable, to unpack it
into your %s placeholder. This theoretically would work if you were to call
it like this:

target.write('%s' % (print_words(someWords)))

But the problem is that your print_words function doesn't return anything
anyways.


On Fri, Nov 2, 2012 at 9:27 AM, Justin Israel <[email protected]>wrote:

> I am not getting the same results as you are because there are more
> problems in this code that happen before I can even see that error. You
> have a mixture of global references that don't seem to work properly.
>
> Can you include a complete traceback to identify the line that is failing?
>
> wordCounter is a defaultdict, which is an iterable, so I am not sure which
> part is causing that error you mention.
>
>
> On Fri, Nov 2, 2012 at 9:22 AM, damon shelton <[email protected]>wrote:
>
>> word counter is a python function object, and probably does not allow +=1
>> on it or calling wordCounter[word]
>> maybe just make a standard int variable called count and +=1 on it
>> everytime you find a word
>>
>> if you just send
>> for line in source:
>>     for word in line.split():
>>         count += 1
>>
>>
>> On Thu, Nov 1, 2012 at 9:15 PM, KI DONG PARK <[email protected]> wrote:
>>
>>> I got error when I try executing it that is 'function' object is not
>>> iterable.
>>> And I have no idea how I should improve it now.
>>> Anybody give me some helping?
>>> Thanks.
>>>
>>>  --
>>> view archives: http://groups.google.com/group/python_inside_maya
>>> change your subscription settings:
>>> http://groups.google.com/group/python_inside_maya/subscribe
>>>
>>
>>  --
>> view archives: http://groups.google.com/group/python_inside_maya
>> change your subscription settings:
>> http://groups.google.com/group/python_inside_maya/subscribe
>>
>
>

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to