openlang

Which Python import syntax will get rid of this deprecation warning?

Hello, Python is new to me. I'm seeing DeprecationWarning saying that using or importing ABCs through 'collections' rather than collections.abc wont work in Python 3.10

import pymssql as pymssql

The import-system documentation (https://docs.python.org/3/reference/import.html) seems technically precise, yet every combination of from and import I've attempted produces a syntax error.

I'm running python 3.9.2, with armv7l GNU/Linux running on my Raspberry Pi

python3 -m pip show pymssql reports an installation under /usr/lib/python3/dist-packages

That directory contains pymssql-2.1.4.egg-info alongside pymssql.cpython-39-arm-linux-gnueabihf.so

Could someone show me the import statement I need?

The conversation continues 3

Follow the reasoning
  1. Permalink

    Hello, Python is new to me. I'm seeing DeprecationWarning saying that using or importing ABCs through 'collections' rather than collections.abc wont work in Python 3.10 import pymssql as pymssql

    Please share the entire exception traceback you're getting. Most probably it isn't something in the code you've written yourself, but something inside pymssql, since it is unfortunately quite common for third-party packages to produce warnings like this, and you need to follow the traceback to establish exactly where this one originates.

    I also noticed that a newer version of pymssql appears to be available. Without the required prerequisites I can't install your version or the newer one, although considering an upgrade seems worthwhile. (Incidentally, the project's GitHub (https://github.com/pymssql/pymssql/) “Releases” list is misleading, with apparently no releases published there after 2020. Development nevertheless seems active in that repository.) I found a closed issue (https://github.com/pymssql/pymssql/issues/576) describing this very warning, which says version 2.1.5 contains the fix, making an upgrade to either 2.1.x or 2.3 a promising solution.

  2. Permalink

    Brilliant, thanks Tavin for taking the trouble to investigate! I'd assumed I was at fault, since thats honestly the case about 99.8 percent of the time. OK I'll try to install a current / working pymssql version; meanwhile I'll suppress the Deprecation warning, taking care to exclude only pymssql warnings. As you probably noticed, I'd rather use mysql with a sizeable community/support, but… “customers get what they ask for” :wink: My few 200 lines already work, so I'll spare you the boredom and deserved criticism. Thanks once more!

  3. Permalink

    I'd assumed I was at fault, since thats honestly the case about 99.8 percent of the time.

    Starting there makes sense :slight_smile: Learning to interpret tracebacks will help you recognise problems coming from libraries, though.

    As you probably noticed, I'd rather use mysql with a sizeable community/support, but… “customers get what they ask for”

    I'm not objecting to MS SQL Server here;[1] (#footnote-409572-1) without any of that installed, I simply can't instantly create a venv and test several versions to check which ones show the problem.

    Glad I could help!

    although PostgreSQL is my own preference! ↩︎ (#footnote-ref-409572-1)

Other sides of the same question

  1. Reducing docker-compose console noise

    Several of my containers produce hundreds upon hundreds of output lines when docker-compose up starts all the services in my…

    Replies 3Latest activity bash
  2. Could D produce Python extension modules rather than using C?

    Apparently D can link against C. I want to write a Python extension module using D. Is there a reason this approach could nev…

    Replies 2Latest activity d
  3. Micro plugins declared through Nix?🤔

    With python we can write this: Python.withPackages (q: with q; [ fastapi ]) Is an equivalent mechanism available for the Micr…

    Replies 3Latest activity nix