title: Variable file name is not being seen as a file and cannot be opened
body: <p>This is my third day with Python and I am sure that something simple is being overlooked.</p>
  
  <p>I am trying to index into a list of html file names, setting the indexed html file name into a var, and then trying to open that file. The plan is to loop through the list of file names.</p>
  
  <p>Unfortunately, the var is not being read as a file but is being read as a name.</p>
  
  <p>I thought this would be an easy question to answer but I am just not finding it.</p>
  
  <p>So, what am I doing wrong? Any help will be highly appreciated.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>file_list = []
     for root, dirs, files in os.walk(r'C:\Aptana\Beautiful'):
       for file in files:
         if file.endswith('.html'):
            file_list.append(file)
  input_file = file_list[0]
  orig_file = open(input_file, 'w')
  </code></pre>
  
  <p>I know that I am missing something simple but I it's driving me nuts!</p>
  
  <p>Update:</p>
  
  <pre><code>file_list = []
  for root, dirs, files in os.walk(r'C:\Aptana\Beautiful'):
   for file in files:
     if file.endswith('.html'):
        file_list.append(os.path.join(root,file))
       input_file = file_list[0]
       orig_file = open(input_file, 'w')
       soup = BeautifulSoup(orig_file)
       title = soup.find('title')      
       main_txt = soup.findAll(id='main')[0]
       toc_txt = soup.findAll(class_ ='toc-indentation')[0]
  </code></pre>
  
  <p>And then the crash:</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\Aptana\beautiful\B-1.py", line 47, in &lt;module&gt;
     soup = BeautifulSoup(orig_file)
   File "C:\Python33\lib\site-packages\bs4\__init__.py", line 161, in __init__
     markup = markup.read()
   io.UnsupportedOperation: not readable
  </code></pre>
  
  <p>Thanks adsmith! Please let me know if you have any other questions.</p>
  
  <p>orig_file is being printed as:
      &lt;_io.TextIOWrapper name='C:\Aptana\Beautiful mode='r' \Administration+Guide.html'               encoding='cp1252'></p>