2

Here is the python code snippet

with open(path, "rb") as sample:
payload = {

    'options': (None,json.dumps (options),'application/json'),'filename':(os.path.basename(path), sample,'application/octet-stream')
}


response = requests.request ("POST", url, headers=headers, files=payload, verify=False)

Files are usually 2GB. I need to upload but while uploading, I am getting a memory error.

 File "C:\Users\H3731736\PycharmProjects\website\venv\lib\site-packages\urllib3\filepost.py", line 92, in encode_multipart_formdata
body.write(b"\r\n")

Error:MemoryError

Please help me understand why this happening and how to solve this.

1 Answers1

0

I tested this on a VM and found out that Python 32-bit version has necessary upper memory limits because of the address space. 64-bit has significantly more address space and switching to the 64bit version fixes the issue.

Arib Muhtasim
  • 147
  • 2
  • 8