Python Forum
python 2.7 access denied when writing a file to Windows
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python 2.7 access denied when writing a file to Windows
#1
Hello,

I'm trying to use a python script to download a file from s3 to my Windows 10 laptop. I'm running the
prompt "as administrator". I have given everyone full access to the folder I'm trying to write the file
to, but windows is still giving an "access denied" error.

import boto3
s3 = boto3.resource('s3')
s3.Bucket('kapps2.services-exchange.com').download_file('myconfig.py', 'C:\data')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\boto3\s3\inject.py", line 168, in bucket_download_file
ExtraArgs=ExtraArgs, Callback=Callback, Config=Config)
File "C:\Python27\lib\site-packages\boto3\s3\inject.py", line 130, in download_file
extra_args=ExtraArgs, callback=Callback)
File "C:\Python27\lib\site-packages\boto3\s3\transfer.py", line 307, in download_file
future.result()
File "C:\Python27\lib\site-packages\s3transfer\futures.py", line 73, in result
return self._coordinator.result()
File "C:\Python27\lib\site-packages\s3transfer\futures.py", line 233, in result
raise self._exception
WindowsError: [Error 5] Access is denied: 'C:\\data'

I'm new to Python, can anyone help with this? Thank You
Reply
#2
It's not python.
That error is generated from OS.
Say right there WindowsError
Reply
#3
SOLVED - I needed to include the file name in the path, it was not good enough to just have the file name and the path.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question [SOLVED] Linefeed when writing "f" strings to text file? Winfried 5 858 Nov-04-2025, 11:51 AM
Last Post: buran
  .xlsm file can't be opened after writing data to one worksheet mhyatt 4 885 Oct-11-2025, 11:25 PM
Last Post: Pedroski55
  Problems writing a large text file in python Vilius 4 2,033 Dec-21-2024, 09:20 AM
Last Post: Pedroski55
  Can a windows file be 'remapped' in Linux ? jehoshua 3 1,718 Dec-07-2024, 03:33 AM
Last Post: jehoshua
  How to re-register .py file extension to new moved Python dir (on Windows)? pstein 5 3,011 Nov-06-2024, 03:06 PM
Last Post: DeaD_EyE
  sharepoint: Access has been blocked by Conditional Access policies CAD79 0 3,879 Jul-12-2024, 09:36 AM
Last Post: CAD79
  Executable file compiled by PyInstaller does not work on Windows 7 amusaber 1 4,584 Jul-11-2024, 02:59 PM
Last Post: DeaD_EyE
  writing list to csv file problem jacksfrustration 5 4,139 Jul-04-2024, 08:15 PM
Last Post: deanhystad
  Circumvent the "access denied" page? Pedroski55 7 3,742 Jun-15-2024, 06:25 AM
Last Post: Pedroski55
  The INSERT permission was denied on the object Steven5055 3 3,901 Jun-12-2024, 08:13 AM
Last Post: GregoryConley

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020