I am calling a python file from a Visual C# form. Click of a button in the C# will call a Python script. The python script will use the config file to connect to the database and provide the results.
If I call the Python program on it's own, it works perfectly. When I call from a Visual C#, the problem occurs. My Python code is like this:
def db_Connection():
logger.info(':Entering db_Connection().....')
logger.info(':Config file read.....')
config = ConfigParser.RawConfigParser()
config.read('config.cfg')
logger.info(':Config file read complete.....')
USER = config.get('DB_Connector','db.user_name' )
logger.info(':USER acquired.....')
PASSWORD = config.get('DB_Connector','db.password' )
SID = config.get('DB_Connector','db.SID' )
IP = config.get('DB_Connector','db.IP')
PORT = config.get('DB_Connector','db.Port')
engine = create_engine('oracle://{user}:{pwd}@{ip}:{port}/{sid}'.format(user=USER, pwd=PASSWORD, ip=IP, port=PORT, sid=SID), echo=False)
connection = engine.connect()
logger.info(':Connected to DB.....')
p = engine.execute("SELECT * from VAM.ASSET where ASSET_ID = '{}'".format(asset_id))
logger.info(':Calculating for any records.....')
if len(p.fetchall())!=0:
print 'Asset Exists'
Looking at the logs, the last line is
2015-04-28 15:40:47,361 INFO :Config file read complete.....
How can I solve this here?