0

I am trying to export an instrument state to a file, so I can reuse its state later, but it seems like there is an issue

from KeysightDSO import KeysightDSO
import sys, os, dill

def DSO_init(args):
    scope = None
    try:
        scope = KeysightDSO(*args)
        # scope.initialization()
    except Exception as e:
        location="TCPIP0::169.254.75.18::hislip0::INSTR"
        scope = KeysightDSO(location)
        # scope.initialization()
    return scope

# scope = DSO_init(sys.argv[1:])
scope = None 
with open('scope_instace.pkl', 'wb') as f:
    if __name__ == '__main__':
        scope = DSO_init(sys.argv[1:])
    else:
        scope = DSO_init()
    dill.dump(scope, f)

the error is below

    raise PicklingError(

PicklingError: Can't pickle <class 'ctypes.CDLL.__init__.<locals>._FuncPtr'>: it's not found as ctypes.CDLL.__init__.<locals>._FuncPtr

Can someone help me to understand the issue and how to fix it ? thanks

Sean H
  • 91
  • 7
  • Does this help? https://stackoverflow.com/a/8805244 Did you write KeysightDSO? It doesn't come up in a duckduckgo search, so I wonder if you can just extract the part of that that you want to pickle. – Alex028502 Oct 29 '21 at 05:59
  • thanks @Alex028502, the KeysightDSO is a class that wraparound the Pyvisa's ResourceManager. I am not sure whether that error is caused by the multiprocessing... – Sean H Oct 29 '21 at 06:10
  • sorry - not saying it's multi processing... just that the answer says most things can't be pickled. – Alex028502 Oct 29 '21 at 07:18

0 Answers0