title: Python Netmiko OSError: Search pattern never detected in send_command_expect:
body: <p>I recently started programming with Python. I work as a network engineer and am currently building a program to pull "state dumps" from Ciena devices. I use netmiko to connect to the device.
  Now I always get the following error:</p>
  
  <p>OSError: Search pattern never detected in send_command_expect: 5160_1></p>
  
  <p>"5160_1>" is the hostname / prompt on the switch. I have read that I can give "expect_string" to a "send_command". Unfortunately, this has no effect and I still get this error.</p>
  
  <p>This is the function with which I create the state dump and call the function for the file download.</p>
  
  <pre><code>def create_sd():
      for ip in sw_connect_ips:
          try:
              sw_connection = ConnectHandler(device_type=sw_dev_type, host=ip, username=sw_usr, password=sw_pw)
              try:
                  print('\nconnnected to host &gt; ' + ip + '\n')
                  hostname = sw_connection.find_prompt()
                  print('hostname of device &gt; ' + hostname)
                  sw_connection.send_command('system server sftp enable', expect_string=hostname)
                  sw_connection.send_command('configuration save', expect_string=hostname)
                  sw_output = sw_connection.send_command('system state-dump file-name ' + ip + '_sd_timestamp_' + str(date.hour) + '_' + str(date.minute) + '_' + str(date.second), expect_string=hostname + ' ')
                  filename = ip + '_sd_timestamp_' + str(date.hour) + '_' + str(date.minute) + '_' + str(date.second)
                  print('got state-dump ' + filename + ' from host &gt; ' + ip)
                  logging.debug(sw_output)
                  logging.debug(sw_connection)
                  sw_connection.disconnect()
                  try:
                      sftp_get(filename, ip)
                  except:
                      raise Exception('scp failed')
              except:
                  raise Exception('command does not exist on switch &gt; ' + ip)
          except:
              raise SSHException('unable to connect to switch check username, password and ip address')
  </code></pre>
  
  <p>I don't know whether all exceptions make so much sense. Maybe someone has a tip for me.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Edit: What is strange in my opinion is that it only occurs with some switches.</p>