LISE-B26 / pylabcontrol

pylabcontrol: Laboratory Equipment Control for Scientific Experiments.
GNU General Public License v3.0
9 stars 9 forks source link

Issue with Script.log_function in python3 #136

Closed akabcenell closed 6 years ago

akabcenell commented 6 years ago

When running AutoFocusCameraSMC ONLY ON PYTHON 3 (not 2)

Traceback (most recent call last): File "C:\Users\NV Experiment\PycharmProjects\py3version\PyLabControl\src\core\scripts.py", line 425, in run self._function() File "C:\Users\NV Experiment\PycharmProjects\py3version\b26_toolkit\src\scripts\autofocus.py", line 196, in _function autofocus_loop(sweep_voltages) File "C:\Users\NV Experiment\PycharmProjects\py3version\b26_toolkit\src\scripts\autofocus.py", line 151, in autofocus_loop self.scripts['take_image'].run() File "C:\Users\NV Experiment\PycharmProjects\py3version\PyLabControl\src\core\scripts.py", line 416, in run self.log('starting script {:s} at {:s} on {:s}'.format(self.name, self.start_time.strftime('%H:%M:%S'),self.start_time.strftime('%d/%m/%y'))) File "C:\Users\NV Experiment\PycharmProjects\py3version\PyLabControl\src\core\scripts.py", line 209, in log self.log_function(string) TypeError: 'bool' object is not callable

Somehow it seems to be passed a wrong log_function in Script.init, unclear exactly how this happens.

asafira commented 6 years ago

Is this fixed? I've seen you use the script more recently than 18 days ago.

akabcenell commented 6 years ago

Log function was being passed arguments improperly. In particular, the script parameters changed, so the parameters were being passed in in the wrong order. Somehow this worked in python 2, but was always wrong.