Cannot get past this string related issue

Oltmans rolf.oltmans at gmail.com
Tue Apr 26 15:48:56 CEST 2011


Greetings, I hope you're doing well. I'm stuck in a strange issue,
most likely due to my own ignorance. I'm reading a config file using
ConfigParser module and passing database related info to _mssql.
Following doesn't work


config = ConfigParser.ConfigParser()
config.read('configs.txt')
server_info = config.get("DB_INFO","server")
db = config.get("DB_INFO","database")
username = config.get("DB_INFO","user")
pwd = config.get("DB_INFO","password")
print server_info,db,username,pwd
conn =
_mssql.connect(server=server_info,database=db,user=username,password=pwd)

but following does work

conn =
_mssql.connect(server='server',database='database',user='user',password='password')


Config file looks like following

[DB_INFO]
server = "server"
database = "database"
user = "user"
password = "password"


But I cannot figure out why? Any ideas or help will be highly
appreciated. Thanks!



More information about the Python-list mailing list