|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
How to run a .exe file through wxpython script ?
Hello All,
I have written a small script which should actually take any exe file and i am using os module to get the path of the exe and it should be executed the number of times which user will input. But its working when i am giving complete path hardcoded. But when i use open dialog to get the file and i am joining the path. I am printing the path taken by the open dialog and it shows correctly but when i am using os.system() function to open that exe it doesn't recognize the path and it takes on C:\dirname which is directory name ofr example C:\python24 but it misses the python.exe part. Can you have a look in the code and tell me where i am missing something. import wx import os class ScrolledWindow(wx.Frame): def __init__(self, parent, id, title): wx.Frameinit__(self, parent, id, title, size=(450, 300)) panel = wx.Panel(self, -1) self.txt1 = wx.TextCtrl(panel, -1, pos=(30, 50), size=(150, 20)) self.button11 = wx.Button(panel, -1, "", pos=(200,50)) self.button11.Bind(wx.EVT_BUTTN, ) self.text1 = wx.StaticText(panel, -1, "Number of times you want the simulation to run", (150, 20)) self.txt2 = wx.TextCtrl(panel, -1, pos=(30, 150), size=(50, 20)) self.button12 = wx.Button(panel, -1, "Run", pos=(200,150)) self.button12.Bind(wx.EVT_BUTTN, Run) #txt1.write(name) self.Centre() self.Show() def Run(self,event): count = int(self.txt2.GetValue()) val = 0 while(val<count): os.system(self.name) print "hello" val +=1 def (self,event): self.dirname = '' dlg = wx.FileDialog(self, "Choose a file", self.dirname,"", "*.exe*", PEN) if dlg.ShowModal()==wx.IDK: self.filename=dlg.GetFilename() self.dirname=dlg.GetDirectory() self.name = os.path.join(self.dirname,self.filename) self.txt1.write(self.name) print self.name dlg.Destroy() app = wx.App() ScrolledWindow(None, -1, 'Run the simulation') app.MainLoop() - Varsha |
![]() |
| Viewing: Web Development Archives > Mailing Lists > Python > How to run a .exe file through wxpython script ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|