TypeError when retrieving random digits
<p>I am trying to generate a random three digit extension:</p>

<pre><code>&gt;&gt;&gt;  ''.join(str(x) for x in random.sample(range(1,10),3))
</code></pre>

<p>It works in the prompt. However, when I run the program, it raises a <code>TypeError: str object is not callable</code>. This is the line that I have:</p>

<pre><code>    filename = hashlib.md5(imagefile.getvalue()).hexdigest() + 
              ''.join(str(x) for x in random.sample(range(1,10),3)) + '_thumb' + '.jpg'  
</code></pre>

<p>What am I doing wrong here and how would I fix it?</p>

<p>Thank you for the help. I had invoked str previously in the code, which was causing the error:</p>

<pre><code>str=""
for c in i.chunks(): 
    str += c
...
</code></pre>
