Pygtk but no gtk?

2006-10-20 Thread chengiz
I am trying to build an app that requires pygtk so I installed the
latter. The app does the following:
import pygtk
...
import gtk

This crashes with
ImportError: No module named gtk.

I dont know where to get this gtk module from. I assumed pygtk would be
it coz the app doesnt mention any dependency on gtk, also googling
didnt find anything but pygtk. Did I screw up the installation or
something? I dont find any gtk.py file in the python library
directories.

Thank you.
Khan

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pygtk but no gtk?

2006-10-20 Thread chengiz
> my pygtk provides
> /usr/lib/python2.4/site-packages/gtk-2.0/gtk/__init__.py, which contains
> the gtk module. You should ensure that you have that file, and if not,
> find out where to get it.

I had the files stored in my local space and my PYTHONPATH was wrong.
It seems PYTHONPATH should contain both ...lib/python2.x and
...lib/python2.x/site-packages while mine was simply ...lib (one'd
expect them to actually mention this in the documentation). Once I
fixed PYTHONPATH, it ran fine, although I still cant figure out why it
got pygtk in the first place coz it wasnt in PYTHONPATH the first time.

Khan

-- 
http://mail.python.org/mailman/listinfo/python-list


Kill an OS process from script (perhaps unix specific)

2008-04-19 Thread chengiz
Hi,
I'm trying to run a process from a python script. I need the exit
status of that process but do not care about its output, so until now
was using os.system(). But it turned out that the process often went
into an infinite loop, so I wrote a SIGALRM handler. Unfortunately the
code I came up with is quite kludgy:

import subprocess
...
try:
  p = subprocess.Popen(..., shell = True)
  pid = p.pid
  os.waitpid(pid...)
  ...
except ...: # Thrown by alarm signal handler
  os.kill(pid + 1)  # "Real" pid = shell pid + 1
  ...

The os.kill is very hacky and unsafe so I was looking for better
ideas. Any help will be greatly appreciated. Thanks!
-- 
http://mail.python.org/mailman/listinfo/python-list