Select the correct trigger source for :TRIG:SING
For a general overview of the SCPI trigger system please refer to Trigger.
In order to use the command :TRIG:SING the correct source (BUS) shall be selected.
Using the default (Internal) source the measurement would start immediately instead of after :TRIG:SING.
Furthermore, the *OPC command would have no effect and not all the measurement data could be available at reading time.
Here is a short program excerpt where the mentioned commands are used in the correct way:
visaSession.write(':TRIG:SOUR BUS\n')
visaSession.write(':INIT\n')
visaSession.write(':TRIG:SING\n')
visaSession.query('*OPC?\n')
frequencyValues = visaSession.query(':SENS:FREQ:DATA?\n')
print("Frequency values: " + frequencyValues)
measurementValues = visaSession.query(':CALC:DATA:SDAT?\n')
print("Meas. values: " + measurementValues)
Without the command :TRIG:SOUR BUS the *OPC is not effective and :SENS:FREQ:DATA? would retrieve just a part of the expected results. How many results it will be, is timing-dependent and not consistent.