What are possible reasons for not being able to access os functions in aiofiles?

33 Views Asked by At

I work with aiofiles module. In the code, I have imported aiofiles, and tried to call makedirs function:

import asyncio
import aiofiles

asyncio.run(aiofiles.os.makedirs('downloads', exist_ok=True))

I got:

AttributeError: module 'aiofiles' has no attribute 'os'

Setup:

  • aiofiles 23.1.0
  • Python 3.10 environment, created with conda (22.9.0).
  • Modules are installed with pip
  • Windows

I found a simple workaround:

from aiofiles import os as aioos 

asyncio.run(aioos.makedirs('downloads', exist_ok=True))

It runs without problems. Yet I did find examples where makedirs was called exactly like aiofiles.os.makedirs.

What is in my setup might be wrong, so that I cannot use aiofiles.os.makedirs with just import aiofiles?

0

There are 0 best solutions below