0

uploading file to s3 bucket but my code shows error

all_pdfs=pathlib.Path(base_folder+'\\selenium_controller\\psdf\\')
file_path=all_pdfs
print(file_path)

for file in all_pdfs.glob('*.pdf'):
    print(file)
    file_main=str(str(file).split("\\")[-1])
    aws_textract = AWSTextract()
    s3_client = aws_textract.connect_S3()
    aws_textract.upload_to_s3(s3_client, str(file_path),str(file_main) )

error

[Errno 13] Permission denied: 'E:\\all_projects\\v1.0.0\\static\\selenium_controller\\psdf'
King
  • 21
  • 5
  • Read the error message. The function you are calling is expecting a path to a file. But `file_path` contains the folder name `'E:\\all_projects\\v1.0.0\\static\\selenium_controller\\psdf'` as the message says. If your code tries to read a folder as if it were a file, Windows will say Permission denied. What I think you meant is `aws_textract.upload_to_s3(s3_client, str(file),str(file_main) )`. – BoarGules Mar 28 '21 at 12:50
  • thanks in file path i also have to \file_name – King Mar 28 '21 at 13:06
  • The error message says otherwise. It says your code tried to open `E:\\all_projects\\v1.0.0\\static\\selenium_controller\\psdf` and that is a folder name. Your filenames all end in `.pdf`. If your variable `file_path` contains the filename, then there is a major bug in the Windows filesystem that nobody but you has ever noticed. The odds are the problem is with your code and not with the Windows filesystem. – BoarGules Mar 28 '21 at 13:10
  • see if this aswer your question: https://stackoverflow.com/questions/36434764/permissionerror-errno-13-permission-denied/36469464 – eyal Mar 28 '21 at 17:03

0 Answers0