title: RasterioIOError: Attempt to create new tiff file failed: Permission denied
body: <p>I am tring to resample Chirps data from 0.25 to 0.0025degrees resolution with the following code, I am still using 1 as an upscale factor to get the code to run:</p>
  <pre><code>import rasterio
  from rasterio.enums import Resampling
  import os
  
  upscale_factor = 1
  
  i = 0
  for files in os.listdir(r'D:/CHIRPS RSDATA/CHIRPS(1981-1983)'):
      if files [-4:] == '.tif':
          i = i + 1
   
          fp = r'D:\CHIRPS RSDATA\CHIRPS(1981-1983)'+'\\'+files
          print(fp)
          dataset = rasterio.open(fp)
          
          data = dataset.read(out_shape=(dataset.count,
                             int(dataset.height*upscale_factor),
                             int(dataset.width*upscale_factor)),
                              resampling=Resampling.bilinear) #You can change the resamplng technique here
          
          if data.shape[-1] != 0 and data.shape[-2] != 0:
                  
              transform=dataset.transform*dataset.transform.scale((dataset.width/data.shape[-1]),(dataset.height/data.shape[-2]))
              
              height = int(dataset.height*upscale_factor)
              width = int(dataset.width*upscale_factor)
              
              with rasterio.Env():
                  profile = dataset.profile
                  profile.update(transform=transform,driver='GTiff',height=height,width=width)
                  
                  with rasterio.open('D:\CHIRPS RSDATA\CHIRPS(1981-1983)\Rainfalls',&quot;w&quot;,**profile) as output: 
                      output.write(data)
                      print(&quot;Image resampled...&quot;)
  </code></pre>
  <p>and I am getting this error:</p>
  <pre><code>runfile('D:/CHIRPS RSDATA/CHIRPS(1981-1983)/Resampling_python.py', wdir='D:/CHIRPS RSDATA/CHIRPS(1981-1983)')
  D:\CHIRPS RSDATA\CHIRPS(1981-1983)\chirps-v2.0.1981.01.01.tif
  Traceback (most recent call last):
  
    File &quot;rasterio\_io.pyx&quot;, line 1139, in rasterio._io.DatasetWriterBase.__init__
  
    File &quot;rasterio\_err.pyx&quot;, line 215, in rasterio._err.exc_wrap_pointer
  
  CPLE_OpenFailedError: Attempt to create new tiff file 'D:/CHIRPS RSDATA/CHIRPS(1981-1983)/Rainfalls' failed: Permission denied
  
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
  
    File &quot;D:\CHIRPS RSDATA\CHIRPS(1981-1983)\Resampling_python.py&quot;, line 42, in &lt;module&gt;
      with rasterio.open('D:\CHIRPS RSDATA\CHIRPS(1981-1983)\Rainfalls',&quot;w&quot;,**profile) as output:
  
    File &quot;C:\Users\khoda\anaconda3\lib\site-packages\rasterio\env.py&quot;, line 435, in wrapper
      return f(*args, **kwds)
  
    File &quot;C:\Users\khoda\anaconda3\lib\site-packages\rasterio\__init__.py&quot;, line 225, in open
      s = writer(path, mode, driver=driver,
  
    File &quot;rasterio\_io.pyx&quot;, line 1143, in rasterio._io.DatasetWriterBase.__init__
  
  RasterioIOError: Attempt to create new tiff file 'D:/CHIRPS RSDATA/CHIRPS(1981-1983)/Rainfalls' failed: Permission denied
  </code></pre>
  <p>I tried changing the permissions of the folder with no luck, I also double checked the synaxes as other people have suggested. Please help.</p>