TypeError: in Python.  
<p>I have an issue, where a function returns a number.  When I then try to assemble a URL that includes that number I am met with failure.</p>

<p>Specifically the error I get is <code>TypeError: cannot concatenate 'str' and 'NoneType' objects</code></p>

<p>Not sure where to go from here.</p>

<p>Here is the relevant piece of code:</p>

<pre><code># Get the raw ID number of the current configuration
configurationID = generate_configurationID()

# Update config name at in Cloud
updateConfigLog = open(logBase+'change_config_name_log.xml', 'w')
# Redirect stdout to file
sys.stdout = updateConfigLog
rest.rest(('put', baseURL+'configurations/'+configurationID+'?name=this_is_a_test_', user, token))
sys.stdout = sys.__stdout__
</code></pre>

<p>It works perfectly if I manually type the following into rest.rest()</p>

<pre><code>rest.rest(('put', http://myurl.com/configurations/123456?name=this_is_a_test_, myusername, mypassword))
</code></pre>

<p>I have tried <code>str(configurationID)</code> and it spits back a number, but I no longer get the rest of the URL...  </p>

<p>Ideas?  Help?</p>

<p>OK...   In an attempt to show my baseURL and my configurationID here is what I did.</p>

<pre><code>print 'baseURL: '+baseURL
print 'configurationID: '+configurationID
</code></pre>

<p>and here is what I got back</p>

<pre><code>it-tone:trunk USER$ ./skynet.py fresh
baseURL: https://myurl.com/
369596
Traceback (most recent call last):
  File "./skynet.py", line 173, in &lt;module&gt;
    main()
  File "./skynet.py", line 30, in main
    fresh()
  File "./skynet.py", line 162, in fresh
    updateConfiguration()
  File "./skynet.py", line 78, in updateConfiguration
    print 'configurationID: '+configurationID
TypeError: cannot concatenate 'str' and 'NoneType' objects
it-tone:trunk USER$ 
</code></pre>

<p>What is interesting to me is that the 369596 is the config ID, but like before it seems to clobber everything called up around it.   </p>

<p>As kindall pointed out below, my generate_configurationID was not <em>returning</em> the value, but rather it was printing it.</p>

<pre><code># from generate_configurationID
def generate_configurationID():
  dom = parse(logBase+'provision_template_log.xml')
  name = dom.getElementsByTagName('id')
  p = name[0].firstChild.nodeValue
  print p
  return p
</code></pre>
