PICC-Group / pynanovna

A python library to easily read and save data from a NanoVNA.
https://pypi.org/project/pynanovna/
Other
8 stars 1 forks source link

worker.kill() produces error #4

Closed OdoctorG closed 6 months ago

OdoctorG commented 6 months ago

worker.kill() produces an error.

Example

from pynanovna import NanoVNAWorker

worker = NanoVNAWorker(verbose=True)
worker.set_sweep(2.9e9,3.1e9,1,101)
worker.calibrate(load_file="signal-processing/oscars_cal.cal")

data = worker.single_sweep()
worker.kill()

produces the error:

NanoVNASaverHeadless is stopping sweepworker now.
Traceback (most recent call last):
  File "c:\Users\Oscar Gren\Documents\PICC\signalprocessing\record.py", line 39, in <module>
    worker.kill()
  File "C:\Users\Oscar Gren\AppData\Local\Programs\Python\Python312\Lib\site-packages\pynanovna\pynanovna.py", line 259, in kill
    self._stop_worker()
  File "C:\Users\Oscar Gren\AppData\Local\Programs\Python\Python312\Lib\site-packages\pynanovna\pynanovna.py", line 190, in _stop_worker
    self.worker_thread.join()
    ^^^^^^^^^^^^^^^^^^
AttributeError: 'NanoVNAWorker' object has no attribute 'worker_thread'
tbergkvist commented 6 months ago

A patch for this has been pushed and will be in the next distribution.