Python
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Web Development Archives Mailing Lists Python

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Web Development Archives Sponsor:
  #1  
Old March 16th, 2008, 12:50 AM
Varsha Purohit
Guest
Dev Archives Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
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

Reply With Quote
Reply

Viewing: Web Development Archives Mailing Lists Python > How to run a .exe file through wxpython script ?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway