Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Python 3.12 breakage: The distutils module is removed #299

Closed
@srh

Description

@srh

We have the line import distutils.version in utils_common.py, but distutils is removed in 3.12:

https://docs.python.org/3.11/library/distutils.html

To Reproduce

srh@pc11:~/sw/rethinkdb-python$ cat test.py 
import asyncio
from rethinkdb import r

async def main():
    connection = await r.connect(db='test')

    await r.table_create('marvel').run(connection)

    marvel_heroes = r.table('marvel')
    await marvel_heroes.insert({
        'id': 1,
        'name': 'Iron Man',
        'first_appearance': 'Tales of Suspense #39'
    }).run(connection)

    # "async for" is supported in Python ≥ 3.6. In earlier versions, you should
    # call "await cursor.next()" in a loop.
    cursor = await marvel_heroes.run(connection)
    async for hero in cursor:
        print(hero['name'])

r.set_loop_type('asyncio')

# "asyncio.run" was added in Python 3.7.  In earlier versions, you
# might try asyncio.get_event_loop().run_until_complete(main()).
asyncio.run(main())


srh@pc11:~/sw/rethinkdb-python$ python3.12 test.py 
Traceback (most recent call last):
  File "/home/srh/sw/rethinkdb-python/test.py", line 2, in <module>
    from rethinkdb import r
  File "/home/srh/sw/rethinkdb-python/rethinkdb/__init__.py", line 93, in <module>
    r = RethinkDB()
        ^^^^^^^^^^^
  File "/home/srh/sw/rethinkdb-python/rethinkdb/__init__.py", line 32, in __init__
    from rethinkdb import (
  File "/home/srh/sw/rethinkdb-python/rethinkdb/_dump.py", line 35, in <module>
    from rethinkdb import _export, utils_common
  File "/home/srh/sw/rethinkdb-python/rethinkdb/_export.py", line 40, in <module>
    from rethinkdb import errors, query, utils_common
  File "/home/srh/sw/rethinkdb-python/rethinkdb/utils_common.py", line 22, in <module>
    import distutils.version
ModuleNotFoundError: No module named 'distutils'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingnot qualifiedThe issue is not checked yet by the owners

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions