mabuchilab / Instrumental

Python-based instrumentation library from the Mabuchi Lab.
http://instrumental-lib.readthedocs.org/
GNU General Public License v3.0
123 stars 80 forks source link

patch fix for python 3.11+ #156

Closed Max-Herbold closed 1 year ago

Max-Herbold commented 1 year ago

The library previously riased ImportError in Python 3.11

Traceback (most recent call last):
    from instrumental.drivers.cameras import uc480
  File "C:\Programs\Python\Python311\Lib\site-packages\instrumental\drivers\__init__.py", line 22, in <module>
    from .facet import Facet, ManualFacet, MessageFacet, SCPI_Facet, FacetGroup
  File "C:\Programs\Python\Python311\Lib\site-packages\instrumental\drivers\facet.py", line 13, in <module>
    from .util import to_quantity
  File "C:\Programs\Python\Python311\Lib\site-packages\instrumental\drivers\util.py", line 8, in <module>
    from inspect import getargspec
ImportError: cannot import name 'getargspec' from 'inspect' (C:\Programs\Python\Python311\Lib\inspect.py)

getargspec no longer exists. getfullargspec is a patch for this and should probably be used for compatibility with future versions of python. I didn't do a full investigation into what changed in inspect and why this change was made but this seems like the commonly accepted resolution.

natezb commented 1 year ago

Great, thanks!

Max-Herbold commented 1 year ago

ah sorry - this needs another small modification - there are extra parameters that are returned in getfullargspec. ill create a new pr to implement this. #160