Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-13-2016, 03:57 PM
vysh vysh is offline
Registered User
 
Join Date: Oct 2014
Posts: 40
[Python] Weird newlines using ReadString

Hi guys, this code give me something unexpected:

Code:
crt.GetTab(tabNum).Screen.IgnoreEscape = True

# Capture upstream interface information
licaShowUSCommand = "show interface upstream\r"

crt.GetTab(tabNum).Screen.Send(licaShowUSCommand)
licaUS = crt.GetTab(tabNum).Screen.ReadString(licaPrompt, 3)

licaUS = re.sub(licaShowUSCommand, '', licaUS)
This is what shows in SecureCRT after running the code:

Code:
miniCMTS>show interface upstream
Channel  Status   Frequency  Channel Width  Modulation              D30Mode  Channel  Inner Power
                  (MHz)      (MHz)          Profile                          Type     (dbmv)     
1        enable   32.0       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0          
2        enable   38.4       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0          
3        enable   44.8       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0          
4        enable   51.2       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0          
miniCMTS>
This is what gets captured in "licaUS" variable:

Code:
Channel  Status   Frequency  Channel Width  Modulation              D30Mode  Channel  Inner Power

                  (MHz)      (MHz)          Profile                          Type     (dbmv)     

1        enable   30.4       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0          

2        enable   36.8       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0          

3        enable   43.2       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0          

4        enable   49.6       6.4            AtdmaMediumNoiseQpsk    disable  ATDMA    0
Hidden characters enabled (see attachment) -- shows extra CRs. Where do they come from? I am really puzzled...
Attached Images
File Type: png upstream.png (16.5 KB, 348 views)

Last edited by vysh; 08-14-2016 at 03:18 PM.
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 06:14 PM.