<br>Oh, gee. Do I feel sheepish. I knew I had been staring at the error all along, but yet couldn't see it.<br><br><br>Thanks!!<br><br><div><span class="gmail_quote">On 2/17/06, <b class="gmail_sendername">Kent Johnson</b>
 &lt;<a href="mailto:kent37@tds.net">kent37@tds.net</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Chris Hallman wrote:
<br>&gt;<br>&gt; Here is my script:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; input = file(rpath, &quot;r&quot;)<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for line in file(rpath):<br>&lt;snip&gt;<br>&gt; for file in dirList:<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; filename = file.lower()<br><br>You use the name 'file' for a global variable. This hides the builtin
<br>function 'file'. This is a bit of a gotcha for newbies - the names of<br>builtins are not reserverd words, so they can be reasigned to your own<br>variables. Some of the names that are commonly (mis)used this way are<br>
file, list and dict. You just have to learn not to do this.<br><br>When you try<br>&nbsp;&nbsp; input = file(rpath, &quot;r&quot;)<br>file contains a string value, which is not callable the way a function<br>is. Hence the error.<br>
<br>The fix is to use a different name for your variable, e.g. 'f'.<br><br>Also you are opening the file twice, you don't need the very first line<br>above. And 'input' is also the name of a builtin ;)<br><br>For reference, here is a list of the built-in functions:
<br><a href="http://docs.python.org/lib/built-in-funcs.html">http://docs.python.org/lib/built-in-funcs.html</a><br><br>&gt; Here is the error:<br>&gt;<br>&gt;&nbsp;&nbsp;&gt;pythonw -u &quot;send_file.py&quot;<br>&gt; c:\temp\config\rtr0544.txt
<br>&gt; Exception in thread Thread-1:<br>&gt; Traceback (most recent call last):<br>&gt;&nbsp;&nbsp; File &quot;c:\python24\lib\threading.py&quot;, line 442, in __bootstrap<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; self.run()<br>&gt;&nbsp;&nbsp; File &quot;send_file.py&quot;, line 45, in run
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp; input = file(rpath, &quot;r&quot;)<br>&gt; TypeError: 'str' object is not callable<br><br>OK, this is saying that you are trying to call a string object, and<br>strings can't be called. You call something with the () syntax. So the
<br>thing you are trying to call is the value of the symbol 'file'.<br>Evidently that is a string rather than the built-in file function.<br><br>Kent<br><br>_______________________________________________<br>Tutor maillist&nbsp;&nbsp;-&nbsp;&nbsp;
<a href="mailto:Tutor@python.org">Tutor@python.org</a><br><a href="http://mail.python.org/mailman/listinfo/tutor">http://mail.python.org/mailman/listinfo/tutor</a><br></blockquote></div><br>