Re: PYTHONPATH and eggs

2010-03-04 Thread geoffbache
On Mar 4, 3:24 am, David Cournapeau wrote: > On Wed, Mar 3, 2010 at 7:14 PM, geoffbache wrote: > > Unfortunately, the location from PYTHONPATH ends up after the eggs in > > sys.path so I can't persuade Python to import my version. The only way > > I've found to fi

PYTHONPATH and eggs

2010-03-03 Thread geoffbache
Hi all, I have a very simple problem that seems to have no simple solution. I have a module which is installed centrally and lives in a Python egg. I have experimented with some minor changes to it and would like to set my PYTHONPATH to pick up my local copy of it, but don't want to have to figur

Re: Problems with background processes on Windows

2009-03-30 Thread geoffbache
On Mar 30, 6:57 am, Gabriel Genellina wrote: > Gabriel Genellina yahoo.com.ar> writes: > > > > > En Sat, 28 Mar 2009 06:03:33 -0300, geoffbache > jeppesen.com>   > > escribió: > > > > Well yes, but the point is surely that the standard output of the

Re: Problems with background processes on Windows

2009-03-28 Thread geoffbache
Hi Tim, > If you trace through this: >     python -m trace --trace communicate.py > > you'll see that it hangs in subprocess in the stdout_thread waiting for > stdout to close. > Thanks for this tip, haven't used this before. > I'm not sure I expect this to work as you expect.  When you open a

Re: Persuading ConfigParser to give me the section elements in the same order as the file

2008-09-11 Thread geoffbache
Hi Matt, > Have a look at this:http://www.python.org/dev/peps/pep-0372/ > Thanks, that was very useful. Good to know these things are being considered. > Looking at the config parser module, it looks like there are only a > couple of places where {} is used. I would create a mixin class to > re

Persuading ConfigParser to give me the section elements in the same order as the file

2008-09-10 Thread geoffbache
Hi all, I recently needed to parse a file that was perfect for ConfigParser apart from one thing: the elements in the sections, although definitions, could in some cases clash with each other and therefore it was important to be able to retrieve them in the same order as they appeared in the file.

Re: Windows process ownership trouble

2008-06-26 Thread geoffbache
Tim, I copied your code exactly from my browser and ran it, so I don't think there was a typo. I could upgrade to Python 2.5.2 I suppose to compare and contrast, but I need to support older Python versions anyway so it's a bit academic... Your speculation about garbage collection did set me goin

Re: Windows process ownership trouble

2008-06-26 Thread geoffbache
Tim, Unfortunately my previous message was premature, it seems your workaround doesn't work either on my system (Windows XP, Python 2.5.1) I get the following printed out Traceback (most recent call last): File "C:\TextTest\processown.py", line 12, in os.remove ("filename") WindowsError:

Re: Windows process ownership trouble

2008-06-26 Thread geoffbache
Thanks Tim, very helpful again. I've now reported this as http://bugs.python.org/issue3210 and implemented your suggested workaround. Regards, Geoff On Jun 25, 9:19 pm, Tim Golden <[EMAIL PROTECTED]> wrote: > geoffbache wrote: > > Am currently being very confused over t

Windows process ownership trouble

2008-06-25 Thread geoffbache
Am currently being very confused over the following code on Windows import subprocess, os file = open("filename", "w") try: proc = subprocess.Popen("nosuchprogram", stdout=file) except OSError: file.close() os.remove("filename") This produces the following exception: Traceback (most

Re: Terminating processes on Windows (handles and IDs)

2008-06-25 Thread geoffbache
Thanks for the help Tim! Good to see this is being sorted in Python at last, although it'll be some time before I can use only Python 2.6 I suspect... I'm making use of _handle now and it works - most of the time. The remaining issues are probably PyGTK problems rather than python ones though, a

Re: Terminating processes on Windows (handles and IDs)

2008-06-24 Thread geoffbache
Thanks for the tip. This does seem rather overkill to introduce all these dependencies just to be able to kill a process though... I've discovered that subprocess.Popen objects have a member "_handle" which is undocumented but appears to work, so I'm using that for now. Better suggestions gratefu

Terminating processes on Windows (handles and IDs)

2008-06-23 Thread geoffbache
Hi all, I've always wondered why os.kill isn't supported on Windows. I found a discussion somewhere from 2006 about this so it seems others have wanted it, but still nothing. So I have a half-baked solution involving calling "taskkill" on Windows Vista or "tskill" on Windows XP via the shell. I fe

Re: Annoying message when interrupting python scripts

2008-06-19 Thread geoffbache
As nobody decried the idea of this being a bug, it now is :) http://bugs.python.org/issue3137 /Geoff -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying message when interrupting python scripts

2008-06-18 Thread geoffbache
Ben is correct in his interpretation of what I'm trying to say. The code "should surely be changed" so that it lets a KeyboardInterrupt exception through. Geoff -- http://mail.python.org/mailman/listinfo/python-list

Re: Annoying message when interrupting python scripts

2008-06-17 Thread geoffbache
To clarify: this is more serious than an incorrect error message, as the intended interrupt gets swallowed and script execution proceeds. Sometimes I seem to get half-imported modules as well, the script failing later with something like AttributeError: 'module' object has no attribute 'getenv'

Annoying message when interrupting python scripts

2008-06-17 Thread geoffbache
Hi all, I find that I semi-frequently get the cryptic message import site failed; use -v for traceback printed on standard error when an arbitrary python script receives SIGINT while the python interpreter is still firing up. If I use -v for traceback I get something along the lines of 'import

Re: Converting a simple python script to a simple windows executable

2008-06-13 Thread geoffbache
Thanks for all the suggestions. I have eventually used a heavily edited version of ExeMaker which seems to do what I want. Geoff -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting a simple python script to a simple windows executable

2008-06-11 Thread geoffbache
On Jun 11, 9:49 pm, jay graves <[EMAIL PROTECTED]> wrote: > On Jun 11, 2:25 pm, geoffbache <[EMAIL PROTECTED]> wrote: > > > Anyone have any better ideas? > > How about ExeMaker? > > http://effbot.org/zone/exemaker.htm > > I have not used it but it seems

Converting a simple python script to a simple windows executable

2008-06-11 Thread geoffbache
Hi all, I have a small python script that doesn't depend on anything except the standard interpreter. I would like to convert it to a small .exe file on Windows that can distributed alone without introducing additional dependencies. I need to assume, because of other python scripts, that anyone us

How to convert markup text to plain text in python?

2008-02-01 Thread geoffbache
I have some marked up text and would like to convert it to plain text, by simply removing all the tags. Of course I can do it from first principles but I felt that among all Python's markup tools there must be something that would do this simply, without having to create an XML parser etc. I've lo

Re: Getting subprocesses to be hidden on Windows

2007-08-28 Thread geoffbache
On 28 Aug, 18:18, Larry Bates <[EMAIL PROTECTED]> wrote: > geoffbache wrote: > > Hi, > > > As part of my efforts to write a test tool that copes with GUIs > > nicely, I'm trying to establish how I can start a GUI process on > > Windows that will not bring u

Re: Getting subprocesses to be hidden on Windows

2007-08-28 Thread geoffbache
OK, more background needed. I develop the TextTest tool which is a generic test tool that starts tested applications from the command line. The idea is that it can handle any system under test at all, whatever language it's written in. Preferably without requiring a bunch of changes to the tested

Re: Getting subprocesses to be hidden on Windows

2007-08-28 Thread geoffbache
> Which GUI toolkit are you using? Tkinter, wxPython, pyQt? Primarily PyGTK, but I was hoping it wouldn't matter. I hope to be able to start the process as indicated in the original post from within my test tool and instruct the subprocess to be hidden (or minimized? would that be easier?), irres

Re: Getting subprocesses to be hidden on Windows

2007-08-28 Thread geoffbache
On Aug 27, 11:28 pm, [EMAIL PROTECTED] wrote: > On Aug 27, 3:21 pm, geoffbache <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > As part of my efforts to write a test tool that copes with GUIs > > nicely, I'm trying to establish how I can start a GUI proce

Getting subprocesses to be hidden on Windows

2007-08-27 Thread geoffbache
Hi, As part of my efforts to write a test tool that copes with GUIs nicely, I'm trying to establish how I can start a GUI process on Windows that will not bring up the window. So I try to hide the window as follows: info = subprocess.STARTUPINFO() info.dwFlags |= subprocess.STARTF_USESHOWWINDOW i

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
On Jun 11, 2:08 pm, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote: > On Mon, 11 Jun 2007 04:56:43 -0700, geoffbache <[EMAIL PROTECTED]> wrote: > > >> Twisted *should* be able to do this, as it uses non-blocking IO. > > >>http://twistedmatrix.com/trac/ >

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
> > You could probably use the Asyncore stuff to do it as well (with a lot > less stuff). This looked interesting. But it seems the asyncore stuff operates at the socket level, whereas I've currently just got a standard synchronous SocketServer and the socket operations themselves are kind of hid

Re: Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
> Twisted *should* be able to do this, as it uses non-blocking IO. > > http://twistedmatrix.com/trac/ Thanks for the tip. I'll take a look if nobody has any better suggestions. It still seems to me that what I'm trying to do is essentially quite simple, and shouldn't require as large a tool as T

Threads, signals and sockets (on UNIX)

2007-06-11 Thread geoffbache
Hi all, I have a Python program (on UNIX) whose main job is to listen on a socket, for which I use the SocketServer module. However, I would also like it to be sensitive to signals received, which it isn't if it's listening on the socket. ("signals can only be received between atomic actions of th