title: Getting NameError: global name 'open' is not defined in online python tutor?
body: <p>I've been sitting at this for hours and I still can't quite solve the error here. I want to open a file and use it in the function 'function_names' but, it appears I can't for whatever reason.  </p>
  
  <p>Here's my code. </p>
  
  <pre><code>def function_names (file_name):        
      openn = open(file_name, 'r')        
      array_form = openn.readlines()    
      length_array = (len(array_form) - 1)        
      count = 0        
      new_array = [];        
      result = " "        
      while (count &lt;= length_array):            
          point = array_form [count]            
          point = str(point)            
          search =point.rfind('def')            
          end = point.rfind('(')            
          if (search != -1):                
              result = point[4:end]                
              new_array.insert(count, result)             
      count = count + 1        
      return (new_array)    
  x = function_names('ex4.py')    
  print (x)
  </code></pre>