title: How to solve Python SyntaxError:in if call while posting dB data to kml with variable-determined map icons?
body: <p>I want to use Python to query data out of a MS Database every 5 minutes and post it into a kml to be viewed by multiple people via network link. I get to the end of the code where I am trying to use the if elif to determine which placemark icon is displayed per row result. Here is my sample code:</p>
  <pre><code>import simplekml
  kml = simplekml.Kml()
  pnt = kml.newpoint(name=&quot;cpeMAC&quot;, coords=[(cpeLON,cpeLAT)])
  pnt.description = &quot;FullAddress&quot;,&quot;Network&quot;
  pnt.snippet.content = &quot;cpeMAC&quot;,&quot;cpeStatus&quot;
  pnt.snippet.maxlines = 1
  pnt.lookat = simplekml.LookAt(gxaltitudemode=simplekml.GxAltitudeMode.relativetoseafloor,
  latitude= cpeLAT, longitude= cpeLON, 
  range=3000, heading=56, tilt=0) 
  # The above range, heading and tilt should be hard coded. 
  # The icon’s for each placemark should change based on the values in cpeStatus. There are 5 output types that can be passed from the dB: None, Off, Repair, Active, Alarm. 
  
  # Below is the code that I need the most help with 
  
  if  cpeStatus = 'Active':
      pnt.style.iconstyle.icon.href = &quot;http://maps.google.com/mapfiles/kml/shapes/ranger_station.png&quot;
      
      elif cpeStatus = 'Off':
          pnt.style.iconstyle.icon.href = &quot;http://maps.google.com/mapfiles/kml/shapes/forbidden.png&quot;
          elif cpeStatus = 'Ready':
              pnt.style.iconstyle.icon.href = &quot;http://maps.google.com/mapfiles/kml/shapes/mechanic.png&quot;
              elif cpeStatus = 'Alarm':
                  pnt.style.iconstyle.icon.href = &quot;http://maps.google.com/mapfiles/kml/shapes/caution.png&quot;
                  return stat
  
  # The file should then be saved to kml stored on the local server. 
  kml.save(&quot;PremiseCPEStatus3.kml&quot;)
  </code></pre>
  <p>I am getting the following consistent error:</p>
  <pre><code> File &quot;&lt;ipython-input-24-49c8d14fb0c8&gt;&quot;, line 26
      if  cpeStatus = 'Active':
                    ^
  SyntaxError: invalid syntax
  </code></pre>
  <p>For reference, the database query is successfully pulling the following information:
  I separated the rows with a  space to make it easier to read</p>
  <pre><code>('124-22-A9-12-44-88', 'Alarm', '32.622399444', '-83.60337837', '365 Johns Rd, Warner Robins, GA 31093', 'eCommunity Warner Robins')  
  ('34-E6-AD-E5-AC-77', 'Alarm', '32.621384', '-83.620274', '606 McArthur Blvd, Warner Robins, GA 31093', 'eCommunity Warner Robins')  
  ('36-E6-AD-E5-AC-77', 'Off', '32.623730', '-83.620145', '365 Johns Rd, Warner Robins, GA 3109', 'eCommunity Warner Robins')  
  ('68-F7-28-ED-12-FA', 'Ready', '32.624298', '-83.627544', '112 Anne Dr, Warner Robins, GA 3109', 'eCommunity Warner Robins')  
  ('00-FF-A8-F3-3D-28', 'Active', '32.620851', '-83.630560', '410 Bernard Dr, Warner Robins, GA 3109', 'eCommunity Warner Robins')  
  (None, None, '32.623577', '-83.628145', '101 Gordon St, Warner Robins, GA 3109', 'eCommunity Warner Robins')
  </code></pre>