Re: Windows: setting title of console window

2011-07-30 Thread Ethan Furman
Thomas Jollans wrote: On 30/07/11 20:39, Ethan Furman wrote: How it works: since the sys.argv object does yet exist, I create an object and assign it to sys.argv; then, when Python assigns the actual argv to sys.argv, my object is tossed, and the __del__ method is called; the __del__ method is t

Re: Windows: setting title of console window

2011-07-30 Thread Thomas Jollans
On 30/07/11 20:39, Ethan Furman wrote: > How it works: since the sys.argv object does yet exist, I create an > object and assign it to sys.argv; then, when Python assigns the actual > argv to sys.argv, my object is tossed, and the __del__ method is called; > the __del__ method is then able to acces

Re: Windows: setting title of console window

2011-07-30 Thread Ethan Furman
Chris Angelico wrote: On Sat, Jul 30, 2011 at 7:39 PM, Ethan Furman wrote: Well, you /could/ have followed the link and read the explanation there... ;) I tend to avoid clicking random links in posts :) Ah -- I understand. How it works: since the sys.argv object does yet exist... That's

Re: Windows: setting title of console window

2011-07-30 Thread Chris Angelico
On Sat, Jul 30, 2011 at 7:39 PM, Ethan Furman wrote: > Well, you /could/ have followed the link and read the explanation there... > ;) I tend to avoid clicking random links in posts :) > How it works: since the sys.argv object does yet exist... That's the bit I didn't understand. I assume that'

Re: Windows: setting title of console window

2011-07-30 Thread Ethan Furman
Chris Angelico wrote: I'm afraid I don't understand this. Why create an object and do the work in the destructor? When will the destructor be called? Will you subsequently be overwriting sys.argv with the actual arguments? This code snippet makes excellent sense if and only if it's executed befo

Re: Windows: setting title of console window

2011-07-30 Thread Chris Angelico
On Sat, Jul 30, 2011 at 6:23 PM, Ethan Furman wrote: > 8<-- sitecustomize.py - > class SetTitle(object): >    def __del__(self): >        command = ' '.join(sys.argv) > > sys.argv = SetTitle() I'm afraid I don't understand this. Why create an object and do the work

Windows: setting title of console window

2011-07-30 Thread Ethan Furman
I came across question http://stackoverflow.com/questions/6485678/ which has to do with setting the console title from sitecustomize.py. With some help from the folks on python-win32 (for the title portion ;) I came up with this: 8<-- sitecustomize.py - import