Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[>=4.4.0] Uploading file with aiohttp seems broken: TypeError: cannot pickle '_io.BufferedReader' object #737

Open
LilSpazJoekp opened this issue Jul 7, 2023 · 6 comments
Labels

Comments

@LilSpazJoekp
Copy link

LilSpazJoekp commented Jul 7, 2023

When uploading files with aiohttp, the following error occurs.

Suspect commit.

Error

TypeError: cannot pickle '_io.BufferedReader' object

aiohttp code to reproduce:

async def upload_file():
    async with aiohttp.ClientSession() as session:
        with open("run.sh", "rb") as f:
            response = await session.post("https://example.com", data={"file": f})

See failed tests here: https://github.com/praw-dev/asyncpraw/pull/246/checks#step:6:5393

@hartwork
Copy link
Collaborator

hartwork commented Jul 7, 2023

Hi @LilSpazJoekp is my understanding correct that this worked with 4.3.0 for you previously?

I'm not sure right now what we can do about these requests not being deepcopy-able. Maybe catch the exception and continue with the original — not sure how bad of an idea that is.

CC #174 #702 @abramclark @kevin1024

@LilSpazJoekp
Copy link
Author

No this worked with 4.2.1 and stopped working with 4.3.0 and on.

@LilSpazJoekp
Copy link
Author

Correction. Not working on 4.3.0 was due to urllib3 issues. After fixing those this worked on 4.3.0 but not on 4.4.0.

@hartwork
Copy link
Collaborator

hartwork commented Jul 7, 2023

@LilSpazJoekp I see, thanks for the clarification 👍

@hartwork hartwork changed the title Uploading file with aiohttp seems broken: TypeError: cannot pickle '_io.BufferedReader' object [>=4.4.0] Uploading file with aiohttp seems broken: TypeError: cannot pickle '_io.BufferedReader' object Jul 7, 2023
@hartwork
Copy link
Collaborator

hartwork commented Jul 7, 2023

@LilSpazJoekp potentially important to know: If this is fixed it will be fixed in a release VCR.py >=5.0.1 with support for >=Python 3.8 only. Your CI shows still shows use of end-of-life Python 3.7 which is why I'm bringing this up.

@LilSpazJoekp
Copy link
Author

That's fine. We plan on dropping 3.7 soon. I thought EOL was later in the year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants