title: IOError: [Errno 13] Permission denied, While opening a file
body: <p>I have a Python script which looks for any changes in a folder(addition/deletion) of files.
  I am looking for any new files added and wants to open them and read some data from them.</p>
  
  <p>The code is </p>
  
  <pre><code># Utility to check for any new jobs
  
  import os
  import win32file
  import win32event
  import win32con
  import string
  
  path= r"C:\Users\dZONE\Desktop\py"
  
  change_handle = win32file.FindFirstChangeNotification      (path,0,win32con.FILE_NOTIFY_CHANGE_FILE_NAME)
  
  try:
  
    old_path_contents = dict ([(f, None) for f in os.listdir (path)])
  while 1:
    result = win32event.WaitForSingleObject (change_handle, 500)
  
  
  if result == win32con.WAIT_OBJECT_0:
    new_path_contents = dict ([(f, None) for f in os.listdir (path)])
    added = [f for f in new_path_contents if not f in old_path_contents]
    #deleted = [f for f in old_path_contents if not f in new_path_contents]
    if added: print "Added: ", ", ".join (added)
    #if deleted: print "Deleted: ", ", ".join (deleted)
    # My open
    print "Len" , len(added)
    for item in added:
     print item
     ad=open(item,'r')
     print ad.read()
  
    old_path_contents = new_path_contents
    win32file.FindNextChangeNotification (change_handle)
  
   finally:
     win32file.FindCloseChangeNotification (change_handle)
  </code></pre>
  
  <p>When i am trying to open the file it is giving me the IO Error 13. Though i have rights on the folder and the file. I wrote another test code and  tried opening the same file directly giving the file name to open() and it did worked.</p>
  
  <p>If anyone can point out the mistake i am doing would be really appreciated.</p>
  
  <p>EDIT: Error message</p>
  
  <pre><code>Traceback (most recent call last):
  File "C:\Users\dZONE\Desktop\py\util.py", line 50, in &lt;module&gt;
  ad=open(item,'r')
  IOError: [Errno 13] Permission denied: 'ad.sjs_hdr'
  </code></pre>
  
  <p>P.S I am new to python so maybe i am making some really silly mistake
  thanks</p>