pyvisa / pyvisa-py

A pure python PyVISA backend
https://pyvisa-py.readthedocs.io
MIT License
282 stars 120 forks source link

tcpip: use max_recv_size as it is supposed to be used #344

Closed MatthieuDartiailh closed 1 year ago

MatthieuDartiailh commented 1 year ago

Per the VXI-11 specification the max_recv_size as provided by the server upon connection is the size of its receive buffer so we use it rather than the hardcoded minimal value of 1024.

codecov-commenter commented 1 year ago

Codecov Report

Merging #344 (40cac33) into main (3893b69) will increase coverage by 0.01%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main     #344      +/-   ##
==========================================
+ Coverage   22.25%   22.27%   +0.01%     
==========================================
  Files          21       21              
  Lines        3199     3197       -2     
  Branches      443      443              
==========================================
  Hits          712      712              
+ Misses       2470     2468       -2     
  Partials       17       17              
Flag Coverage Δ
unittests 22.27% <0.00%> (+0.01%) :arrow_up:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pyvisa_py/tcpip.py 19.80% <0.00%> (+0.07%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

eric-evola commented 1 year ago

@MatthieuDartiailh, After updating from pyvisa-py 0.5.3 to 0.6.0 we see the class registration error when attempting to open a resource.

.../pyvisa_py/sessions.py", line 198, in get_session_class
    "No class registered for %s, %s" % (interface_type, resource_class)
ValueError: No class registered for InterfaceType.tcpip, INSTR
MatthieuDartiailh commented 1 year ago

Could you post the output of pyvisa-info ? I will look into ASAP.

MatthieuDartiailh commented 1 year ago

I cannot reproduce. Could you give me more details ?

eric-evola commented 1 year ago

Below is the output of pyvisa-info when using the pyvisa-info 0.6.0. Reverting back Pyvisa-py to 0.5.3 fixes the issue.

Resource Manager Backend:
Resource Manager of Visa Library at py

Debug info:
Machine Details:
   Platform ID:    Linux-5.11.0-051100-generic-x86_64-with-debian-buster-sid
   Processor:      x86_64

Python:
   Implementation: CPython
   Executable:     /tmp/Bazel.runfiles_74pfa9by/runfiles/__main__/common/python/runtime/python3_entrypoint_python_3.7_no_debug
   Version:        3.7.13
   Compiler:       GCC 7.5.0
   Bits:           64bit
   Build:          Jul  6 2022 21:28:00 (#default)
   Unicode:        UCS4

PyVISA Version: 1.12.0

Backends:
   ivi:
      Version: 1.12.0 (bundled with PyVISA)
      Binary library: Not found
   py:
      Version: 0.6.0
      ASRL INSTR:
         Please install PySerial (>=3.0) to use this resource type.
         No module named 'serial'
      USB INSTR:
         Please install PyUSB to use this resource type.
         No module named 'usb'
      USB RAW:
         Please install PyUSB to use this resource type.
         No module named 'usb'
      GPIB INSTR:
         Please install linux-gpib (Linux) or gpib-ctypes (Windows, Linux) to use this resource type. Note that installing gpib-ctypes will give you access to a broader range of funcionality.
         No module named 'gpib'
MatthieuDartiailh commented 1 year ago

Can you test with the current main and post the output of pyvisa-info ?

eric-evola commented 1 year ago

Using the current main for PyVISA and PyVISA-py, the issue does not appear for me. So it seems to be fixed in the current main of PyVISA-py.

`Resource Manager Backend: Resource Manager of Visa Library at py debug info: Machine Details: Platform ID: Linux-5.11.0-051100-generic-x86_64-with-debian-buster-sid Processor: x86_64

Python: Implementation: CPython Executable: /tmp/Bazel.runfiles_cw6sjprl/runfiles/main/common/python/runtime/python3_entrypoint_python_3.7_no_debug Version: 3.7.13 Compiler: GCC 7.5.0 Bits: 64bit Build: Jul 6 2022 21:28:00 (#default) Unicode: UCS4

PyVISA Version: 0.0.0

Backends: ivi: Version: 0.0.0 (bundled with PyVISA) Binary library: Not found py: Version: 0.0.0 ASRL INSTR: Please install PySerial (>=3.0) to use this resource type. No module named 'serial' USB INSTR: Please install PyUSB to use this resource type. No module named 'usb' USB RAW: Please install PyUSB to use this resource type. No module named 'usb' TCPIP INSTR: Available Resource discovery:

MatthieuDartiailh commented 1 year ago

Thanks, I will do my best to cut a release shortly