Am 26.04.2011 15:48, schrieb Oltmans:

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')

Ok, if you are this far: what prevents you from trying

print server_info, db, username, pwd

and being aware that IF there are " around, they are not part of the string representation, but they are really there.


Config file looks like following

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

I think if you will have seen the output above, you will probably see what is wrong here: too many "s. :-)

HTH & HAND!

Thomas
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to