PyVISA异常被忽略:<object repr()=“” failed =“”>

时间:2018-07-13 12:45:38

标签: python pycharm visa pyvisa

我有一个RIGOL DP832A电源,仪器无法正常关闭,并且会忽略异常:

  

在以下情况中忽略异常:追溯(最新   最后调用):文件“ C:\ Program Files   (x86)\ Python36-32 \ lib \ site-packages \ pyvisa \ resources \ resource.py”,   第108行,位于 del 文件“ C:\ Program Files   (x86)\ Python36-32 \ lib \ site-packages \ pyvisa \ resources \ resource.py”,   236行,在关闭文件“ C:\ Program Files中   (x86)\ Python36-32 \ lib \ logging__init __。py“,第1293行,在调试文件中   “ C:\ Program Files(x86)\ Python36-32 \ lib \ logging__init __。py”,行   1546,在isEnabledFor TypeError中:实例之间不支持'> ='   'int'和'NoneType'的

在调试错误时,当我调用psu.close()函数时,它将调用“ C:\ Program Files(x86)\ Python36-32 \ Lib \ site-packages \ pyvisa \ resources \ resource的关闭函数.py“ 并检索以下消息:无法从239 ” logger.debug('%s-is closeed',self._resource_name,extra = self ._logging_extra)” 。除了具有同一个资源管理器的PSU之外,我还有多个仪器连接,但是首先我需要正常退出PSU的过程。我通过以下命令连接了Rohde和Shwarz FSP13: self.interface = visa_rm.open_resource(f“ RSIB :: {地址} :: INSTR”,resource_pyclass = MessageBasedResource) 代码:

self.interface1 = visa_rm.open_resource(f"TCPIP::{address}::INSTR")
self.interface1.close()
def cleanup(self, msg_q):
    self.dut.close()
    self.psu.set_output(DUT_PSU_CHANNEL, False)
    self.psu.close()

Machine Details:
   Platform ID:    Windows-10-10.0.17134-SP0
   Processor:      Intel64 Family 6 Model 63 Stepping 2, GenuineIntel

Python:
   Implementation: CPython
   Executable:     C:\Program Files (x86)\Python36-32\python.exe
   Version:        3.6.5
   Compiler:       MSC v.1900 32 bit (Intel)
   Bits:           32bit
   Build:          Mar 28 2018 16:07:46 (#v3.6.5:f59c0932b4)
   Unicode:        UCS4

PyVISA Version: 1.8

Backends:
   ni:
      Version: 1.8 (bundled with PyVISA)
      #1: C:\Windows\system32\visa32.dll:
         found by: auto
         bitness: 32
         Vendor: National Instruments
         Impl. Version: 17825792
         Spec. Version: 5244672
      #2: C:\Windows\system32\visa32.dll:
         found by: auto
         bitness: 32
         Vendor: National Instruments
         Impl. Version: 17825792
         Spec. Version: 5244672

试图更新到最新的PyVISA 1.9仍然是同样的问题。 更新到1.9后,这是日志:

pydev debugger: process 7928 is connecting

Connected to pydev debugger (build 181.4203.547)
2018-07-13 12:25:50,049 - pyvisa - DEBUG - viParseRsrcEx(98496160, 'TCPIP::192.168.85.200::INSTR', 'c_ushort(6)', 'c_ushort(0)', <ctypes.c_char_Array_256 object at 0x0AD26800>, <ctypes.c_char_Array_256 object at 0x0AD268F0>, <ctypes.c_char_Array_256 object at 0x0AD26940>) -> 0
2018-07-13 12:25:50,049 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - opening ...
TCPIPInstrument at TCPIP0::192.168.85.200::inst0::INSTR
2018-07-13 12:25:50,055 - pyvisa - DEBUG - viOpen(98496160, 'TCPIP::192.168.85.200::INSTR', <AccessModes.no_lock: 0>, 0, '<ViObject object at 0x0AD26940>') -> 0
2018-07-13 12:25:50,055 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - is open with session 97490656
2018-07-13 12:25:50,055 - pyvisa - DEBUG - viGetAttribute(97490656, 3221159938, <ctypes.c_char_Array_256 object at 0x0AD26940>) -> 0
2018-07-13 12:25:50,057 - pyvisa - DEBUG - viWrite(97490656, b'*IDN?\r\n', 7, 'c_ulong(7)') -> 0
2018-07-13 12:25:50,057 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2018-07-13 12:25:50,058 - pyvisa - DEBUG - viRead(97490656, <ctypes.c_char_Array_20480 object at 0x0AD26940>, 20480, 'c_ulong(49)') -> 0
RIGOL TECHNOLOGIES,DP832A,DP8B195201974,00.01.16

2018-07-13 12:25:50,062 - pyvisa - DEBUG - viWrite(97490656, b'*RST\r\n', 6, 'c_ulong(6)') -> 0
2018-07-13 12:25:50,088 - pyvisa - DEBUG - viWrite(97490656, b':OUTP CH1,ON\r\n', 14, 'c_ulong(14)') -> 0
2018-07-13 12:25:50,097 - pyvisa - DEBUG - viWrite(97490656, b':SOUR1:VOLT 0.000000\r\n', 22, 'c_ulong(22)') -> 0
2018-07-13 12:25:51,099 - pyvisa - DEBUG - viWrite(97490656, b':SOUR1:VOLT 3.300000\r\n', 22, 'c_ulong(22)') -> 0
2018-07-13 12:25:51,108 - pyvisa - DEBUG - viWrite(97490656, b'SOUR1:CURR 0.800000\r\n', 21, 'c_ulong(21)') -> 0
2018-07-13 12:25:51,117 - pyvisa - DEBUG - viWrite(97490656, b':SOUR1:CURR:PROT 0.800000\r\n', 27, 'c_ulong(27)') -> 0
2018-07-13 12:25:51,127 - pyvisa - DEBUG - viWrite(97490656, b':OUTP CH1,ON\r\n', 14, 'c_ulong(14)') -> 0
2018-07-13 12:25:52,130 - pyvisa - DEBUG - viWrite(97490656, b':OUTP CH2,ON\r\n', 14, 'c_ulong(14)') -> 0
2018-07-13 12:25:52,138 - pyvisa - DEBUG - viWrite(97490656, b':SOUR2:VOLT 0.000000\r\n', 22, 'c_ulong(22)') -> 0
2018-07-13 12:25:53,143 - pyvisa - DEBUG - viWrite(97490656, b':SOUR2:VOLT 3.300000\r\n', 22, 'c_ulong(22)') -> 0
2018-07-13 12:25:53,152 - pyvisa - DEBUG - viWrite(97490656, b'SOUR2:CURR 0.800000\r\n', 21, 'c_ulong(21)') -> 0
2018-07-13 12:25:53,161 - pyvisa - DEBUG - viWrite(97490656, b':SOUR2:CURR:PROT 0.800000\r\n', 27, 'c_ulong(27)') -> 0
2018-07-13 12:25:53,171 - pyvisa - DEBUG - viWrite(97490656, b':OUTP CH2,ON\r\n', 14, 'c_ulong(14)') -> 0
2018-07-13 12:25:54,903 - pyvisa - DEBUG - viWrite(97490656, b':OUTP CH1,OFF\r\n', 15, 'c_ulong(15)') -> 0
2018-07-13 12:25:54,911 - pyvisa - DEBUG - viWrite(97490656, b':OUTP CH2,OFF\r\n', 15, 'c_ulong(15)') -> 0
2018-07-13 12:25:54,912 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - closing
2018-07-13 12:25:54,912 - pyvisa - DEBUG - viDisableEvent(97490656, 1073709055, 65535) -> 1073676291
2018-07-13 12:25:54,912 - pyvisa - DEBUG - viDiscardEvents(97490656, 1073709055, 65535) -> 1073676292
2018-07-13 12:25:54,920 - pyvisa - DEBUG - viClose(97490656,) -> 0
2018-07-13 12:25:54,920 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - is closed
2018-07-13 12:25:54,920 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - closing
2018-07-13 12:26:05,735 - pyvisa - DEBUG - viParseRsrcEx(103735736, 'TCPIP::192.168.85.200::INSTR', 'c_ushort(6)', 'c_ushort(0)', <ctypes.c_char_Array_256 object at 0x07383530>, <ctypes.c_char_Array_256 object at 0x07383620>, <ctypes.c_char_Array_256 object at 0x07383670>) -> 0
2018-07-13 12:26:05,735 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - opening ...
TCPIPInstrument at TCPIP0::192.168.85.200::inst0::INSTR
2018-07-13 12:26:05,750 - pyvisa - DEBUG - viOpen(103735736, 'TCPIP::192.168.85.200::INSTR', <AccessModes.no_lock: 0>, 0, '<ViObject object at 0x07383670>') -> 0
2018-07-13 12:26:05,750 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - is open with session 102121448
2018-07-13 12:26:05,751 - pyvisa - DEBUG - viGetAttribute(102121448, 3221159938, <ctypes.c_char_Array_256 object at 0x07383670>) -> 0
2018-07-13 12:26:05,753 - pyvisa - DEBUG - viWrite(102121448, b'*IDN?\r\n', 7, 'c_ulong(7)') -> 0
2018-07-13 12:26:05,753 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - reading 20480 bytes (last status <StatusCode.success_max_count_read: 1073676294>)
2018-07-13 12:26:05,754 - pyvisa - DEBUG - viRead(102121448, <ctypes.c_char_Array_20480 object at 0x07383670>, 20480, 'c_ulong(49)') -> 0
RIGOL TECHNOLOGIES,DP832A,DP8B195201974,00.01.16
2018-07-13 12:26:05,758 - pyvisa - DEBUG - viWrite(102121448, b'*RST\r\n', 6, 'c_ulong(6)') -> 0
2018-07-13 12:26:05,790 - pyvisa - DEBUG - viWrite(102121448, b':OUTP CH1,ON\r\n', 14, 'c_ulong(14)') -> 0
2018-07-13 12:26:05,799 - pyvisa - DEBUG - viWrite(102121448, b':SOUR1:VOLT 0.000000\r\n', 22, 'c_ulong(22)') -> 0
2018-07-13 12:26:06,800 - pyvisa - DEBUG - viWrite(102121448, b':SOUR1:VOLT 3.000000\r\n', 22, 'c_ulong(22)') -> 0
2018-07-13 12:26:06,809 - pyvisa - DEBUG - viWrite(102121448, b'SOUR1:CURR 0.800000\r\n', 21, 'c_ulong(21)') -> 0
2018-07-13 12:26:06,819 - pyvisa - DEBUG - viWrite(102121448, b':SOUR1:CURR:PROT 0.800000\r\n', 27, 'c_ulong(27)') -> 0
2018-07-13 12:26:06,828 - pyvisa - DEBUG - viWrite(102121448, b':OUTP CH1,ON\r\n', 14, 'c_ulong(14)') -> 0
2018-07-13 12:26:08,217 - pyvisa - DEBUG - viWrite(102121448, b':OUTP CH1,OFF\r\n', 15, 'c_ulong(15)') -> 0
2018-07-13 12:26:08,217 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - closing
2018-07-13 12:26:08,218 - pyvisa - DEBUG - viDisableEvent(102121448, 1073709055, 65535) -> 1073676291
2018-07-13 12:26:08,218 - pyvisa - DEBUG - viDiscardEvents(102121448, 1073709055, 65535) -> 1073676292
2018-07-13 12:26:08,225 - pyvisa - DEBUG - viClose(102121448,) -> 0
2018-07-13 12:26:08,225 - pyvisa - DEBUG - TCPIP::192.168.85.200::INSTR - is closed

任何帮助将不胜感激。 预先感谢。

0 个答案:

没有答案