Menu

#78 DeprecationWarning from python language wrapper module

v1.0 (example)
open
nobody
None
5
2021-10-26
2021-10-25
mika
No

Preconditions:
- ubuntu 20.04 and kernel 5.11.0-36
- linux-gpib-4.3.4
- build and install python language support : make && make install
- Python 3.8.10 - used

Python test code:
----8<----8<----8<----8<----8<----8<
import gpib

board_address = 0
gpib_device_address = 6

con=gpib.dev(board_address, gpib_device_address)
gpib.write(con, b'*IDN?')
print(gpib.read(con,1000))
gpib.close(con)
----8<----8<----8<----8<----8<----8<

Actual warning when gpib-library is used:
"DeprecationWarning: PY_SSIZE_T_CLEAN will be required for '#' formats"

Changes needed to:
../linux-gpib-4.3.4/linux-gpib-user-4.3.4/language/python/gpibinter.c

Tested fix proposal in attached patch file.

1 Attachments

Discussion

  • DaveP

    DaveP - 2021-10-26

    Your patch has been applied to the svn. Thank you.
    Not being a pythoneer perhaps someone can suggest a fix for the DeprecationWarning below from a build with python3.10.
    cheers,
    -dave

    { /usr/bin/python3 setup.py build && touch build; } || { rm -f -r build; exit 1; }
    /home/dave/src/linux-gpib-code/linux-gpib-user/language/python/setup.py:3: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
      from distutils.core import setup,Extension
    
     
  • mika

    mika - 2021-10-26

    Hi,

    You can try to replace the original line from setup.py with:

    import sys
    if sys.version_info < (3,10):
        from distutils.core import setup,Extension
    else:
        from setuptools import setup, Extension
    

    distutils is deprecated and setuptools should be used insted.

     

    Last edit: mika 2021-10-26
  • DaveP

    DaveP - 2021-10-26

    Thanks mika, this worked. Pushed to svn.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.