473,545 Members | 2,755 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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,c ommand):
Thread.__init__ (self)
self.command = command
def run(self):
os.execv(self.c ommand)
Jul 18 '05 #1
2 5482
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(comma nd + "&")

</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(comma nd + "&")


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(comm and + "&")" 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
3253
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 ('arping -w 1 -c 1 -I eth1 192.168.0.2') ARPING 192.168.0.2 from 62.233.239.115 eth1 Sent 1 probes (1 broadcast(s)) Received 0 response(s)
7
3974
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. This would allow for other plugins and the main application to be free to do other work. I have written a little TestDriver for the plugin and am...
3
1232
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 my system, i start the appl.exe file and the gui appears. there are 4 threads running as the taskmanager shows me. then i click on the start button...
4
2285
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 the screen and keeps the user informed about what is happening during data transfer to/from the Pocket PC. Everything has been working fine with...
5
4477
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
12193
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 event handlers may take longer than the interval for either of the timers, so it's possible for multiple events to fire "simultaneously" and for...
8
3353
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 on a network for files and then copies these files to another location (on the network) AND then updates a record in the database. The file copying...
4
5706
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 everyting is secured by Invoke/BeginInvoke, and synchronisation primitves like WaitHandles, Evetns, Semaphores, etc... All works good and with no...
1
7168
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 will close the splash screen and kill the thread.
0
7432
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7943
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7456
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7786
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5359
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3470
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1919
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
743
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.