title: Error using subprocess with export ODBCINI in python?
body: <p>I need to connect to a test server and run a sql query using pyodbc. For that I first need to set ODBCINI environment variable. I tried including that in python code using subprocess.</p>
  
  <pre><code>import subprocess
  import pyodbc
  
  bashCommand = "export ODBCINI=~/odbc.ini"
  process = subprocess.Popen(bashCommand.split(), stdout=subprocess.PIPE, shell=True)
  
  pyodbc.pooling = False
  conn = pyodbc.connect(DSN='test',autocommit=True,ansi=True)
  cur = conn.cursor()
  </code></pre>
  
  <p>Below is the error I get</p>
  
  <pre><code>Traceback (most recent call last):
    File "my_si_web_impressions_bcookie_dealid.py", line 15, in &lt;module&gt;
      conn = pyodbc.connect(DSN='tdwb',autocommit=True,ansi=True)
  pyodbc.Error: ('IM002', '[IM002] [DataDirect][ODBC lib] System information file not found. Please check the ODBCINI environment variable. (0) (SQLDriverConnect)')
  </code></pre>
  
  <p>I guess it implies that it din't export the ODBCINI variable so it couldn't connect to server. Can anyone help?</p>