473,903 Members | 5,672 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

subprocess problem in cygwin with Tkinter

this has me puzzled; I've created a small test app to show the problem
I'm having.

I want to use subprocess to execute system commands from inside a
Tkinter app running under Cygwin.

When I open a python interpreter and run my subprocess command, all is
well. But when I run the same command from inside a Tkinter app, I'm
getting errors.

I'm using this version of Cygwin:
$ uname -a
CYGWIN_NT-5.1 Mulata 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown unknown Cyg

When I run my command in a python shell, all is well:

smidwint@Mulata /cygdrive/c/programs/pipeworksb/lib/python/popt
$ python
Python 2.4.1 (#1, May 27 2005, 18:02:40)
[GCC 3.3.3 (cygwin special)] on cygwin
Type "help", "copyright" , "credits" or "license" for more information.
import subprocess
dirlist = subprocess.Pope n('/usr/bin/ls', shell=True, bufsize=2048, stdout= subprocess.PIPE ).stdout dirlist <open file '<fdopen>', mode 'rb' at 0x49d848> for dir in dirlist: .... print dir
test_subprocess .py
test_subprocess .py.bak

When I run the same command in a Tkinter app, I get an exception:

smidwint@Mulata /cygdrive/c/programs/pipeworksb/lib/python/popt
$ python test_subprocess .py
d:\cygwin\bin\p ython2.4.exe (7752): *** unable to remap d:\cygwin\bin\t k84.dll t
o same address as parent(0x18C400 00) != 0x18C50000
9 [main] python 4696 fork_parent: child 7752 died waiting for dll loading
Traceback (most recent call last):
File "test_subproces s.py", line 19, in ?
l = Tkinter.Label(t ext=dir_list())
File "test_subproces s.py", line 8, in dir_list
dirlist = subprocess.Pope n('/usr/bin/ls', shell=True, bufsize=2048, stdout=s
ubprocess.PIPE) .stdout
File "/usr/lib/python2.4/subprocess.py", line 558, in __init__
errread, errwrite)
File "/usr/lib/python2.4/subprocess.py", line 918, in _execute_child
self.pid = os.fork()
OSError: [Errno 2] No such file or directory
Here's a sample Tkinter app that reproduces the problem:

#test_subproces s.py
import subprocess, os
import Tkinter

def dir_list():
'''provide a listing of files in a directory'''
#need to know which system to draw from
curdir = os.getcwd()
dirlist = subprocess.Pope n('/usr/bin/ls', shell=True,
bufsize=2048, stdout=subproce ss.PIPE).stdout
#dirlist = subprocess.Pope n(['ls',' -l'],
stdout=subproce ss.PIPE).stdout .communicate()[0]
print dirlist
msgList = []
for dir in dirlist:
print dir
msgList.append( dir)
msg = '\n'.join(msgLi st)
return msg

root = Tkinter.Tk()
l = Tkinter.Label(t ext=dir_list())
b = Tkinter.Button( text='ok',comma nd=root.destroy )
BTW, the test_subprocess .py test script that ships with Cygwin python runs fine.

any ideas?
Stewart Midwinter
st*****@midwint er.ca
st************* **@gmail.com
Skype, GoogleTalk, iChatAV, MSN, Yahoo: midtoad
Jan 5 '06 #1
2 4095
Stewart Midwinter wrote:
I'm using this version of Cygwin:
$ uname -a
CYGWIN_NT-5.1 Mulata 1.5.18(0.132/4/2) 2005-07-02 20:30 i686 unknown unknown Cyg
When I run the same command in a Tkinter app, I get an exception:

smidwint@Mulata /cygdrive/c/programs/pipeworksb/lib/python/popt
$ python test_subprocess .py
d:\cygwin\bin\p ython2.4.exe (7752): *** unable to remap d:\cygwin\bin\t k84.dll t
o same address as parent(0x18C400 00) != 0x18C50000
9 [main] python 4696 fork_parent: child 7752 died waiting for dll loading
any ideas?

This is a dll problem that sometimes happens in Cygwin. Run 'rebaseall'
to fix this.


Jan 5 '06 #2
that's it! Thanks, that sorted me out. The readme at the following
location was very helpful:
I couldn't get rebaseall to work until I installed all of the packages
mentioned in the readme.

Now I have a different problem, regarding Pmw menus, but I've posted a
separate item on that. thanks again.

Jan 5 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Jörg Maier | last post by:
Hey guys, i have a big problem using Tkinter and pexpect in cygwin. i try to program an winscp-like rsync Program for all posix Platforms (linux, macosx, cygwin). i got a class SslConnection with a method listDirectory that gives back a list of an remote directory using pexpect. this method works in linux, it works in cygwin-python from command-line, but invoked in an Tkinter-Program i got the strange Exception:...
by: Pekka Niiranen | last post by:
Hi, I started cygwin shell with command subprocess.call("c:\\cygwin\\cygwin.bat") from Python 2.4. Shell works fine but the fonts/layout are set according to program "c:\winnt\system32\cmd.exe".
by: Michael McGarry | last post by:
Hi, I am just starting to use Python. Does Python have all the regular expression features of Perl? Is Python missing any features available in Perl? Thanks, Michael
by: Pekka Niiranen | last post by:
Hi there I have installed Cygwin to my w2k machine and use Python to execute Bash -shell scripts. I noticed that in script below parameter "shell=False" causes raw_input() to fail; the only way to stop script is to kill the Dos window where it is run (The Bash shell runs OK listing directory contents to screen).
by: Ivo Woltring | last post by:
Hi Pythoneers, I am trying to make my own gui for mencoder.exe (windows port of the terrific linux mencoder/mplayer) to convert divx to Pocket_PC size. My current app creates a batch script to run the mencoder with the needed params, but now I want to integrate mencoder as a subprocess in my app. What already works: the starting of the subprocess.Popen and the subsequent killing of the process if I want it to.
by: gh14tq5 | last post by:
Hi, I've recently started learning python programming and have been experimenting with a few basic GUI programs. My work system is cygwin/Windows XP. I use X-windows in cygwin but when I run my python/tkinter program from an x-win terminal , a normal XP window is opened up. Any text output from the program of course shows up in the terminal I started the program from. Is there a way to make python open up a window in the X display...
by: Eric_Dexter | last post by:
I am having trouble contolling vim with subprocess on a windows machine. It appears that vim comes up on the machine all right and it sometimes looks like it is doing the searchs what I am asking it to do but when I am asking it to load a file it doesn't do anything. Is there something I need to do to push the data through the pipe?? Here is a couple different ways I am trying to do it. def load_instrument(instr_name, csdname): "load...
by: Dave Sampson | last post by:
hey folks, A simple question hopefully. despite all my searching I have not found a satisfactory response. The goal. Interact with a command line program. Simple enough, but the key is INTERACT. I tried the shell and comand approaches but that initiates, it does not allow interaction with the programs.
by: Harishankar | last post by:
Hi, Sorry to start off on a negative note in the list, but I feel that the Python subprocess module is sorely deficient because it lacks a mechanism to: 1. Create non-blocking pipes which can be read in a separate thread (I am currently writing a mencoder GUI in Tkinter and need a full fledged process handler to control the command line and to display the progress in a text-box)
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
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 most users, this new feature is actually very convenient. If you want to control the update process,...
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.