473,385 Members | 1,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

os.system() inside a thread problem

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
2 5469
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: przemas_r | last post by:
Hello everybody. I've found python's behaviour I can't understand. Namely the way os.system () works depending if it's being run in Thread's run function or run in 'normal' way. >>> os.system...
7
by: David Elliott | last post by:
I have created an application that will dynamically load other DLLs (plugins). The new plugin is a winform with an embedded IE Browser. I am wanting to have the form to run in its own thread....
3
by: Pascal Frey | last post by:
Hi, I just wrote a small simple C# application with a small gui. I was testing the application continous on my development system. Now i tried to let it run on another system but it doesn't. On...
4
by: Robert W. | last post by:
I'm building a WinForms app that is a companion to a Pocket PC app. The WinForms app initiates a separate thread that calls a Notification window. This window resides in the lower right corner of...
5
by: MSDN | last post by:
Does anyone know why I am getting Invalid cast exception??? For Each oFile As System.web.HttpPostedFile In Request.Files ....... etc..... Next I Checked that
5
by: Tony Gravagno | last post by:
I have a class that instantiates two Timer objects that fire at different intervals. My class can be instantiated within a Windows Form or from a Windows Service. Actions performed by one of the...
8
by: Ollie Riches | last post by:
I'm looking into a production issue related to a windows service and System.Timers.Timer. The background is the windows service uses a System.Timers.Timer to periodically poll a directory location...
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and...
1
by: raghudr | last post by:
Hi all, I am displaying a splash screen for which i have created a thread. Logic is: 1) i will first create a thread to display a splash screen until a big process is completed 2)then i...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.