NameError: global name 'this_submit' is not defined
<p>The following function seems really simple, but I keep getting:</p>

<blockquote>
  <p>NameError: global name 'this_submit' is not defined.</p>
</blockquote>

<p>Ideas?</p>

<pre><code>def sort_nodes():

host_list=Popen(hosts_cmd.split(),stdout=PIPE).communicate()[0].strip()
exec_list=Popen(exec_cmd.split(),stdout=PIPE).communicate()[0].strip()
if submit_cmd == '':
    submit_list = [x for x in host_list if x not in exec_list]
else:
    submit_list=Popen(submit_cmd.split(),stdout=PIPE).communicate()[0].strip()
for host in host_list:
    if host in exec_list:
        this_exec == 'Exec'
    else:
        this_exec == ''
    if host in submit_list:
        this_submit == 'Submit'
    else:
        this_submit == ''
    output="%s,%s,%s\n" % (host,this_submit,this_exec)
    ofile.write(output)
</code></pre>
