labrad / pylabrad

python interface for labrad
51 stars 31 forks source link

Node can't start because Python 3.11 dropped inspect.getargspec #396

Open xiaoyuejin opened 1 year ago

xiaoyuejin commented 1 year ago

Just upgraded to Python 3.11 and got this error:

......\Lib\site-packages\labrad\decorators.py", line 111, in init argspec = inspect.getargspec(self.func) ^^^^^^^^^^^^^^^^^^ AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?

Turned out Python 3.11 dropped inspect.getargspec completely, hence the error.

The current version of pylabrad in this repo has solved the problem by replacing inspect.getargspec with inspect.getfullargspec. However, this improvement happened after the latest release (0.98.2). So if someone uses python 3.11 and only pip install pylabrad, he will get the error and the node will fail to start.

So basically, a new release (0.98.21?) based on the current repo will solve the problem.

xiaoyuejin commented 6 months ago

A new but similar issue:

Lib\site-packages\labrad\node__init__.py", line 644, in refreshServers config = server_config.from_string(conf, f, path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\LabRAD\WPy64-31221b3\python-3.12.2.amd64\Lib\site-packages\labrad\node\server_config.py", line 33, in from_string scp.readfp(io.StringIO(conf)) ^^^^^^^^^^ AttributeError: 'ConfigParser' object has no attribute 'readfp'. Did you mean: 'read'?

Fixed by replacing ConfigParser.readfp() with ConfigParser.read_file().