View Single Post
  #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, 363 views)

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