can't connect to multimeter with python (visa)










0















I am trying to communicate with multimeter agilent 34401a with python. I use visa library. My source is very simple:



import visa
rm = visa.ResourceManager()
list_re = rm.list_resources()
print(list_re)
inst_v = rm.open_resource('ASRLCOM1::INSTR')
inst_v.write('SYSTEM:REMOTE')
inst_v.write('*CLS')
print( inst_v.query('*IDN?'))


after last line I get errors:



E:softpytest>open.py
('ASRLCOM1::INSTR', 'ASRLCOM2::INSTR')
Traceback (most recent call last):
File "E:softpytestopen.py", line 8, in <module>
print( inst_v.query('*IDN?'))
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 569, in query
return self.read()
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 413, in read
message = self._read_raw().decode(enco)
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 386, in _read_raw
chunk, status = self.visalib.read(self.session, size)
File "E:softpylibsite-packagespyvisa-pyhighlevel.py", line 350, in read
raise errors.VisaIOError(ret[1])
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.


If i write each line manually in console i see:



>>> inst_v.write('SYSTEM:REMOTE')
(15, <StatusCode.success: 0>)


or



>>> inst_v.write('SYST:REM')
(10, <StatusCode.success: 0>)


what does this mean and where is my problem? i connect with aglent through moxa uport 1250 (rs-232). any help will be appreciated










share|improve this question






















  • What you do in console is different from your script? What does '*CLS' do?

    – stovfl
    Nov 13 '18 at 10:04











  • Your script is crashing on the *IDN? line, so it is also accepting the SYSTEM:REMOTE command which comes before this. Your code is crashing at the first point where the instrument is expected to respond because it is not responding. I would check if you are using the correct port (is your device connected to port 2 maybe?), and check that you are using the correct terminator. Try *IDN?n, for example. It might be easier to do this kind of debugging using the NI MAX tool.

    – RPM
    Nov 13 '18 at 13:49
















0















I am trying to communicate with multimeter agilent 34401a with python. I use visa library. My source is very simple:



import visa
rm = visa.ResourceManager()
list_re = rm.list_resources()
print(list_re)
inst_v = rm.open_resource('ASRLCOM1::INSTR')
inst_v.write('SYSTEM:REMOTE')
inst_v.write('*CLS')
print( inst_v.query('*IDN?'))


after last line I get errors:



E:softpytest>open.py
('ASRLCOM1::INSTR', 'ASRLCOM2::INSTR')
Traceback (most recent call last):
File "E:softpytestopen.py", line 8, in <module>
print( inst_v.query('*IDN?'))
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 569, in query
return self.read()
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 413, in read
message = self._read_raw().decode(enco)
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 386, in _read_raw
chunk, status = self.visalib.read(self.session, size)
File "E:softpylibsite-packagespyvisa-pyhighlevel.py", line 350, in read
raise errors.VisaIOError(ret[1])
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.


If i write each line manually in console i see:



>>> inst_v.write('SYSTEM:REMOTE')
(15, <StatusCode.success: 0>)


or



>>> inst_v.write('SYST:REM')
(10, <StatusCode.success: 0>)


what does this mean and where is my problem? i connect with aglent through moxa uport 1250 (rs-232). any help will be appreciated










share|improve this question






















  • What you do in console is different from your script? What does '*CLS' do?

    – stovfl
    Nov 13 '18 at 10:04











  • Your script is crashing on the *IDN? line, so it is also accepting the SYSTEM:REMOTE command which comes before this. Your code is crashing at the first point where the instrument is expected to respond because it is not responding. I would check if you are using the correct port (is your device connected to port 2 maybe?), and check that you are using the correct terminator. Try *IDN?n, for example. It might be easier to do this kind of debugging using the NI MAX tool.

    – RPM
    Nov 13 '18 at 13:49














0












0








0








I am trying to communicate with multimeter agilent 34401a with python. I use visa library. My source is very simple:



import visa
rm = visa.ResourceManager()
list_re = rm.list_resources()
print(list_re)
inst_v = rm.open_resource('ASRLCOM1::INSTR')
inst_v.write('SYSTEM:REMOTE')
inst_v.write('*CLS')
print( inst_v.query('*IDN?'))


after last line I get errors:



E:softpytest>open.py
('ASRLCOM1::INSTR', 'ASRLCOM2::INSTR')
Traceback (most recent call last):
File "E:softpytestopen.py", line 8, in <module>
print( inst_v.query('*IDN?'))
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 569, in query
return self.read()
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 413, in read
message = self._read_raw().decode(enco)
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 386, in _read_raw
chunk, status = self.visalib.read(self.session, size)
File "E:softpylibsite-packagespyvisa-pyhighlevel.py", line 350, in read
raise errors.VisaIOError(ret[1])
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.


If i write each line manually in console i see:



>>> inst_v.write('SYSTEM:REMOTE')
(15, <StatusCode.success: 0>)


or



>>> inst_v.write('SYST:REM')
(10, <StatusCode.success: 0>)


what does this mean and where is my problem? i connect with aglent through moxa uport 1250 (rs-232). any help will be appreciated










share|improve this question














I am trying to communicate with multimeter agilent 34401a with python. I use visa library. My source is very simple:



import visa
rm = visa.ResourceManager()
list_re = rm.list_resources()
print(list_re)
inst_v = rm.open_resource('ASRLCOM1::INSTR')
inst_v.write('SYSTEM:REMOTE')
inst_v.write('*CLS')
print( inst_v.query('*IDN?'))


after last line I get errors:



E:softpytest>open.py
('ASRLCOM1::INSTR', 'ASRLCOM2::INSTR')
Traceback (most recent call last):
File "E:softpytestopen.py", line 8, in <module>
print( inst_v.query('*IDN?'))
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 569, in query
return self.read()
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 413, in read
message = self._read_raw().decode(enco)
File "E:softpylibsite-packagespyvisaresourcesmessagebased.py", line 386, in _read_raw
chunk, status = self.visalib.read(self.session, size)
File "E:softpylibsite-packagespyvisa-pyhighlevel.py", line 350, in read
raise errors.VisaIOError(ret[1])
pyvisa.errors.VisaIOError: VI_ERROR_TMO (-1073807339): Timeout expired before operation completed.


If i write each line manually in console i see:



>>> inst_v.write('SYSTEM:REMOTE')
(15, <StatusCode.success: 0>)


or



>>> inst_v.write('SYST:REM')
(10, <StatusCode.success: 0>)


what does this mean and where is my problem? i connect with aglent through moxa uport 1250 (rs-232). any help will be appreciated







python serial-port visa






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 7:17









dsheedshee

62




62












  • What you do in console is different from your script? What does '*CLS' do?

    – stovfl
    Nov 13 '18 at 10:04











  • Your script is crashing on the *IDN? line, so it is also accepting the SYSTEM:REMOTE command which comes before this. Your code is crashing at the first point where the instrument is expected to respond because it is not responding. I would check if you are using the correct port (is your device connected to port 2 maybe?), and check that you are using the correct terminator. Try *IDN?n, for example. It might be easier to do this kind of debugging using the NI MAX tool.

    – RPM
    Nov 13 '18 at 13:49


















  • What you do in console is different from your script? What does '*CLS' do?

    – stovfl
    Nov 13 '18 at 10:04











  • Your script is crashing on the *IDN? line, so it is also accepting the SYSTEM:REMOTE command which comes before this. Your code is crashing at the first point where the instrument is expected to respond because it is not responding. I would check if you are using the correct port (is your device connected to port 2 maybe?), and check that you are using the correct terminator. Try *IDN?n, for example. It might be easier to do this kind of debugging using the NI MAX tool.

    – RPM
    Nov 13 '18 at 13:49

















What you do in console is different from your script? What does '*CLS' do?

– stovfl
Nov 13 '18 at 10:04





What you do in console is different from your script? What does '*CLS' do?

– stovfl
Nov 13 '18 at 10:04













Your script is crashing on the *IDN? line, so it is also accepting the SYSTEM:REMOTE command which comes before this. Your code is crashing at the first point where the instrument is expected to respond because it is not responding. I would check if you are using the correct port (is your device connected to port 2 maybe?), and check that you are using the correct terminator. Try *IDN?n, for example. It might be easier to do this kind of debugging using the NI MAX tool.

– RPM
Nov 13 '18 at 13:49






Your script is crashing on the *IDN? line, so it is also accepting the SYSTEM:REMOTE command which comes before this. Your code is crashing at the first point where the instrument is expected to respond because it is not responding. I would check if you are using the correct port (is your device connected to port 2 maybe?), and check that you are using the correct terminator. Try *IDN?n, for example. It might be easier to do this kind of debugging using the NI MAX tool.

– RPM
Nov 13 '18 at 13:49













0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275742%2fcant-connect-to-multimeter-with-python-visa%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275742%2fcant-connect-to-multimeter-with-python-visa%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto