Click to See Complete Forum and Search --> : Invoking Python script method using C program


pkkamath
April 29th, 2004, 11:45 AM
I load Start.py python script using C program and invoke user defined method in the script. This works fine for the first item. But, second time onwards, I am unable to invoke "CreateDialog() and CreateDialog2() methods. what may be the mistake

The script file is as follows:

class Start:
def __init__(self,val):
f=open(r'D:\\Download\\CreateDialog\\nskinfo', 'a')
f.write("The function __init__ is called\n")
f.close()

def Execute(self, value):
f=open(r'D:\\Download\\CreateDialog\\nskinfo', 'a')
f.write("The function Execute is called\n")
f.close()
self.CreateDialog(value)
self.CreateDialog2(value)

def CreateDialog2(value):
f=open(r'D:\\Download\\CreateDialog\\nskinfo', 'a')
f.write("The function CreateDialog2 is called\n")
f.close()

def CreateDialog(self, value):
from win32com.client import Dispatch
o=Dispatch("CreateDialog.MyProjectDialog")
o.InvokeDialogBoxCb(value)
f=open(r'D:\\Download\\CreateDialog\\nskinfo', 'a')
f.write("The function CreateDialog is called\n")
f.close()

def __del__(self):
f=open(r'D:\\Download\\CreateDialog\\nskinfo', 'a')
f.write("The function DEL is called\n")
f.close()

Thanks in advance