question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

send_command returns incomplete output

See original GitHub issue

ex:

device = {'device_type':'cisco_ios'...
shell = ConnectHandler(**device)
shell.enable()
out = shell.send_command("write memory")
print(out)

returns:

Building configuration…

but the full output should be:

Building configuration… Compressed configuration from 543610 bytes to 149342 bytes[OK]

I tried a bit of a hack-around like so:

out = shell.send_command(self.args.cmd, max_loops=500)
out += shell.read_until_prompt()

which returns:

Building configuration… Compressed configuration from 543610 bytes to 149342 bytes[OK] my_host#

with the prompt at the end.

Is there a better way to collect all of the output from send_command before it returns, or is using a read_until method the correct solution? I guess i’m also a bit confused because “show version” returned a big multi-line block of output without any trouble.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
lundybernardcommented, Jun 16, 2016

README.md has been updated to show this solution. closing issue.

0reactions
ktbyerscommented, Jun 15, 2016

Sure.

Kirk

On Wed, Jun 15, 2016 at 10:20 AM, Lundy Bernard notifications@github.com wrote:

@ktbyers https://github.com/ktbyers thanks! send_command_expect() took care of the problem, and its now working as expected.

Mind if I add that to the examples in README.md?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ktbyers/netmiko/issues/223#issuecomment-226257268, or mute the thread https://github.com/notifications/unsubscribe/AA26hFDi8ZEwBpqodlgvaMk1n_tAole5ks5qMDRigaJpZM4I1yHv .

Kirk Byers CCIE #6243 emeritus ktbyers@twb-tech.com _http://pynet.twb-tech.com http://pynet.twb-tech.com/blog_ (415) 264-6270 Simplify your network management through automation

Read more comments on GitHub >

github_iconTop Results From Across the Web

CoreNFC NFCISO7816APDU sendCommand…
I have been able to detect the card send multiple apdu's to the card and get the card number and the purse balance...
Read more >
send-command — AWS CLI 1.27.32 Command Reference
Enables Systems Manager to send command output to CloudWatch Logs. ... it validates the command inputs and returns a sample output JSON for...
Read more >
send-command — AWS CLI 2.9.8 Command Reference
Enables Systems Manager to send command output to CloudWatch Logs. ... it validates the command inputs and returns a sample output JSON for...
Read more >
Is there a way to check that ssm send_command is running ...
The return of the send_command is a dictionary which contains an id ... We can get also the output of the command and...
Read more >
An error occurred when sending commands to the program ...
Article · 07/21/2022 · 6 minutes to read · 7 contributors · Applies to: Excel 2016, Excel 2013, Excel 2010, Microsoft Office Excel...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found