title: reading special characters text from .ini file in python
body: <p>I am running a script which takes a text "rAh%19u^l\&amp;G" i.e which contains special characters as seen.</p>
  
  <p>When i pass this text in my script as a argument it runs fine without any error.</p>
  
  <p>example - : <code>./abc.py &lt;username&gt;&lt;pwd&gt;</code></p>
  
  <p>The above text is basically a password.</p>
  
  <p>Now, when i place my values in a config file and read the above text, <strong>the script fails</strong>.</p>
  
  <p>*******abc.ini *******</p>
  
  <pre><code>[DEFAULT]
  username = rahul
  pwd =  rAh%19u^l\&amp;G
  </code></pre>
  
  <p>it says</p>
  
  <pre><code>/bin/sh:M command not found.
  </code></pre>
  
  <p>Reading the above values with help of config parser</p>
  
  <p>******Below is the program abc.py  ******</p>
  
  <pre><code>#! /usr/bin/python
  
  parser = configparser.ConfigParser()
  parser.read('abc.ini')
  username = parser.get('DEFAULT','username')
  pwd = parser.get('DEFAULT','pwd')
  
  
  p = subprocess.Popen(
      "abc.py {0} {1}" .format(username, pwd), 
      shell=True, 
      stdout=subprocess.PIPE
  )
  
  out, err = p.communicate()
  
  print(out)
  </code></pre>
  
  <p>I tried searching a lot but found nothing concrete. </p>
  
  <p>So the question is how to read a text that contains special characters in a .ini file.</p>