Tinche / aiofiles

File support for asyncio
Apache License 2.0
2.66k stars 150 forks source link

OS module import fails #130

Open Wh1teStr1pe opened 2 years ago

Wh1teStr1pe commented 2 years ago

image

Cannot import correctly anything from os.path module and cannot use its functions like path.exists()

Tinche commented 2 years ago

Ah, you're saying from aiofiles.os.path import exists doesn't work?

Wh1teStr1pe commented 2 years ago

@Tinche yes, there was no way to import path from aiofiles.os and use its functions. I could fix it only by running pip install types-aiofiles

realsuayip commented 2 years ago

I had the same issue today. Installing types-aiofiles wouldn't help me though. Python 3.10.1

cpvandehey commented 1 year ago

Same thing. Seeing this in mypy: error: Module has no attribute "os" [attr-defined]

ehn-pkalinowski commented 1 year ago

you need to import aiofiles.os I had to look into the sources to deduce it...

xhy2008 commented 7 months ago

import aiofiles.os Traceback (most recent call last): File "", line 1, in File "/data/data/com.termux/files/home/aiofiles-23.2.1/src/aiofiles/os.py", line 41, in link = wrap(os.link) ^^^^^^^ AttributeError: module 'os' has no attribute 'link'. Did you mean: 'unlink'?

I got this error. I tried to change a version,but it didn't work.

n-ce commented 5 months ago

I got this error. I tried to change a version,but it didn't work.

Getting the same error.

Wh1teStr1pe commented 5 months ago

@xhy2008 @n-ce

try this from aiofiles import os as aos

n-ce commented 5 months ago

@xhy2008 @n-ce

try this from aiofiles import os as aos

I tried to remove the link = wrap(os.link) line from os.py yesterday and it worked. I also learned that this is a fixed issue but not released yet.