title: Python [Errno 13] Permission denied:
body: <p>I'm attempting to write a quick python script to iterate through all csv files in the current folder and remove the header row from them then store them in a separate folder.</p>
  
  <p>The current working directory has four sample csv files and the python script.  Once executed the script creates the HeaderRemoved directory.</p>
  
  <p>It appears that once the folder is created the code that is attempting to read the files is trying to access the folder but looking at the code I'm not sure why it would be.</p>
  
  <p>I'm on a windows machine at the moment.</p>
  
  <pre><code>import csv, os, argparse, string
  from ctypes import *
  
  os.makedirs('HeaderRemoved', exist_ok=True)
  
  # Loop through files in the current working directory
  for csvFile in os.listdir('.'):
      if not csvFile.endswith('.csv'):
          continue                            # Skips non-csv files
      print ('Removing header from ' + csvFile + '...')
  
  # Read in CSV skipping the first row
  csvRows = []
  csvFileObj = open(csvFile)
  csvReader = csv.reader(csvFileObj)
  
  for row in csvReader:
      if csvReader.line_num == 1:
          continue                            # Skips the first row
      csvRows.append(row)
  csvFileObj.close()
  
  # Write out the CSV file
  csvFileObj = open (os.path.join('HeaderRemoved', csvFile), 'w', newline='')
  for row in csvRows:
      csvWriter.writerow(row)
  
  csvFileObj.close()
  </code></pre>
  
  <p>Sample output:</p>
  
  <pre><code>Removing header from examplefile_1.csv... 
  Removing header from examplefile_2.csv... 
  Removing header from examplefile_3.csv... 
  Removing header from examplefile_4.csv... 
  Traceback (most recent call last):   File "atbs_csv_parse.py", line 14, in &lt;module&gt;
      csvFileObj = open(csvFile) PermissionError: [Errno 13] Permission denied: 'HeaderRemoved'
  </code></pre>