title: TypeError: can only concatenate str (not "NoneType") to str, working with optparse module
body: <pre><code>import subprocess
  import optparse
  
  def change_mac(interface, new_mac):
      print(&quot;[+] Changing MAC address for &quot; + interface + &quot; to &quot; + new_mac)
  
      subprocess.call([&quot;ifconfig&quot;, interface, &quot;down&quot;])
      subprocess.call([&quot;ifconfig&quot;, interface, &quot;hw&quot;, &quot;ether &quot;, new_mac])
      subprocess.call([&quot;ifconfig&quot;, interface, &quot;up&quot;])
  
  
  parser = optparse.OptionParser()
  
  parser.add_option( &quot;-i&quot;, &quot;--interface&quot;, dest=&quot;interface&quot;, help=&quot;interface to change its MAC address&quot;)
  parser.add_option( &quot;-m&quot;, &quot;--mac&quot;, dest=&quot;new_mac&quot;, help=&quot;new MAC address&quot;)
  
  (options, arguments) = parser.parse_args()
  change_mac(options.interface, options.new_mac)
  </code></pre>
  <p>this is the error</p>
  <pre><code>Traceback (most recent call last):
    File &quot;main.py&quot;, line 19, in &lt;module&gt;
      change_mac(options.interface, options.new_mac)
    File &quot;main.py&quot;, line 7, in change_mac
      print(&quot;[+] Changing MAC address for &quot; + interface + &quot; to &quot; + new_mac)
  TypeError: can only concatenate str (not &quot;NoneType&quot;) to str
  </code></pre>
  <p>I'm aware of Python Basics and ive done a few programs before this , I was following a course and the guy made this exact program but he isnt getting errors, I am. If somebody could help me understand the problem it would be really helpful cuz i dont want to progress further into the course without fixing this.</p>