By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,928 Members | 1,568 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,928 IT Pros & Developers. It's quick & easy.

os.system() inside a thread problem

P: n/a
Hello,

my thread calls a program with os.system().
os.system("/usr/bin/wine /path/to/ultima/online.exe") Ultima Online is starting and i can enter commands and navigate through the
game with my keyboard. If I move the mouse over the Ultima Online window
Ultima Online crashes. (the mouse just need to overlap 1 pixel of the egde
of the window. titlebar inlcuded) /usr/bin/wine: line 55: 11675 Segmentation fault

Same with os.popen()

If I run os.system() outside the thread everything is working like expected.
Other programs (wine emulated and nativ) work inside and outside the thread.

Can anyone tell me how I can fix this?
Google told me simillar problems were fixed by upgrading to python 2.4. that
is no option for me.

Thanks,
Daniel
some example code:

from threading import Thread
runuo = StartUO(command)
runuo.start()

class StartUO(Thread):
def __init__(self,command):
Thread.__init__(self)
self.command = command
def run(self):
os.execv(self.command)
Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Daniel Bernhardt wrote:
my thread calls a program with os.system().
os.system("/usr/bin/wine /path/to/ultima/online.exe")

in the example you included, you use execv. which one is it?
Ultima Online is starting and i can enter commands and navigate through the
game with my keyboard. If I move the mouse over the Ultima Online window
Ultima Online crashes. (the mouse just need to overlap 1 pixel of the egde
of the window. titlebar inlcuded)
/usr/bin/wine: line 55: 11675 Segmentation fault

Same with os.popen()

If I run os.system() outside the thread everything is working like expected.
Other programs (wine emulated and nativ) work inside and outside the thread.

Can anyone tell me how I can fix this?


just curious: do you really have to use a thread? why not just do

os.system(command + "&")

</F>

Jul 18 '05 #2

P: n/a
Fredrik Lundh wrote:
in the example you included, you use execv. which one is it?
it should be system(). I just played a bit and forgot to change it back.

just curious: do you really have to use a thread? why not just do

os.system(command + "&")


No, i don't need to use a thread. I just wanted learn something about it and
thought it would be a good start.
I will use "os.system(command + "&")" as you said to solve the problem.
Thanks.
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.