Closed dougthor42 closed 1 year ago
Hmm... I thought that this would just be a simple fix in logging, but it looks like it's more of an architectural decision.
The devices.Device.write
method requires sending a single byte at a time: https://github.com/pyvisa/pyvisa-sim/blob/b0c22826ad506cc5c5acc155bdca3764dfe14f5e/pyvisa_sim/devices.py#L230-L238
And the session.usb.USBInstrumentSession.write
method sends single bytes: https://github.com/pyvisa/pyvisa-sim/blob/b0c22826ad506cc5c5acc155bdca3764dfe14f5e/pyvisa_sim/sessions/usb.py#L63-L67
Same with the other session objects.
Is there a particular reason for this design choice? Would it be reasonable for me to switch things so that Device.write
accepts bytes of any length?
I have honestly no idea why @hgrecco went with this design. I am personally fine with writing larger chunks.
Neato burrito :burrito:. I'll try and find some time this week or weekend to make the change. I also notice a lot of code duplication with sessions.foo.FooSession.write
, so I'll probably clean that up first.
Debug logging prints every character individually, rather than just the sent command string:
Whereas running with a real instrument via the
pyvisa-py
backend logs nothing:Steps to Reproduce:
mysim.yaml
file andexample.py
files found below.example.py
Actual Behavior
Each character is written in a separate log message.
Expected (Desired) Behavior
The full string is written in a single log message:
mysim.yaml
example.py