title: "local and global" SyntaxError
body: <p>Why does the function <code>openFehBgQ</code> not like the two instructions marked Comments 1 &amp; 2?</p>
  
  <p>Comment 1 tries to update the <code>fehCurrent</code>, which is declared <code>global</code>, but produces the following error:</p>
  
  <pre><code>      SyntaxError: name 'fehCurrent' is local and global ;
  </code></pre>
  
  <p>Comment 2 does not work at all, although <code>timeKill</code> is remembered for the <code>time.sleep</code> function.       </p>
  
  <pre><code>#!/usr/bin/env python
  # -*- coding: utf-8 -*-
  import glob, subprocess, time, os
  
  def globalVariables():
      global fehCurrent # Title (str) of current 'Child' window
      global fehNew # Title (str) of new 'Child' window
      global fehWindow # Data (array) for current 'Child' window
      global timeKill
      global timeZero
  
  
  # Data (array) for current 'Child' window
  fehBg = ['fehBg', '-g', '%ux%u+%u+%u' % (320, 240,  
      50,50), '-x', 'Media/Bg.jpg']
  fehCurrent = 'fehq1'    # Title (str) of current 'Child' window
  
  def openFehBgQ():
      if fehCurrent != fehNew:
          subprocess.Popen(fehWindow)
          time.sleep(timeKill)
          os.popen('%s%s' % ('pkill ', fehCurrent))
          # fehCurrent = fehNew    # See Comment 1
          timeElapsed = 0
          # timeZero = time.time()    # See Comment 2
  
  fehNew = "fehBg"
  fehWindow = fehBg
  openFehBgQ() 
  print "1_", fehCurrent
  fehCurrent = fehNew
  print "2_", fehCurrent
  timeZero = time.time()
  </code></pre>