-
Notifications
You must be signed in to change notification settings - Fork 51
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
It is not possible to parse a file with newline (\n etc.) #38
Comments
@k-zaytsev this was a puzzling one, but I think the culprit is import asyncio
from aiofile import AIOFile
data = b'hi'
async def main():
with open("test.data", "wb") as fp:
fp.write(data)
async with AIOFile("test.data", "rb") as fp:
while True:
buf = await fp.read(2)
if not buf:
break
print(buf)
asyncio.run(main()) When running locally, that script never finishes. It doesn't matter how many bytes you try to read from Please confirm that you can reproduce what I see with that sample script. If you agree with the diagnose, please close this issue; I'd also suggest you either create an issue against |
Thanks! This helped me a lot to understand the problem! |
It's missuse of aiofile cause the The reason is the aiofile is a library to made real asyncronous file operations. Asyncronous API with builtin file position pointer doesn't known to me. So for user this abstracitons will be provided as addidional utilities. Please double check the aiofile README, it contains a solution. |
Please help. What am I doing wrong?
The text was updated successfully, but these errors were encountered: