title: Why do I get a Errno 1 Operation not permitted when the folder is created with full read/write permissions for everyone in Python?
body: <p>So I am trying to make my very first python program to automate a task that I have. The first snippet of code is from a python script that makes a new folder at a pre-specified destination and then moves files from their original location to the new folder. This part works. The folder is created like so:</p>
  
  <pre><code>os.makedirs(new_folder, 0o777)
  </code></pre>
  
  <p>new_folder stores the name, given by the user, of the folder to be created.</p>
  
  <p>The next snippet of code is from another script that does the opposite. It takes the files from the new folder and moves them back to the original folder and it does this successfully. However what doesn't work is what is supposed to happen next. Once moved back, it is supposed to delete the new folder with its content. I tried doing it with this code:</p>
  
  <pre><code>os.chdir(new_path)
  os.remove(folder_name)
  </code></pre>
  
  <p>og_path is just a variable that stores the path of the new folder which should be deleted. folder_name stores well...the folder's name</p>
  
  <p>When I run the full code of the second script everything works; however when it reaches:</p>
  
  <pre><code>os.remove(folder_name)
  </code></pre>
  
  <p>It gives me this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/TVM/Desktop/python/move_file/move_file_reverse.py", line  25, in &lt;module&gt;
  os.remove(folder_name)
  PermissionError: [Errno 1] Operation not permitted: 'lab3'
  </code></pre>
  
  <p>Additional Variable Information:</p>
  
  <pre><code> new_folder = "lab3"
   folder_name = "lab3"
   new_path = "/Users/TVM/Desktop/python/move_file/newloc"
  </code></pre>
  
  <p>The folder called <em>lab3</em> is in the folder <em>newloc</em></p>