Re: python and vc numbers

2009-12-02 Thread Daniel Dalton
Can you make do with the tempfile module? Or you'd need to identify from an external process which console is locked? Perhaps, I wrote a small hack: - Manually set environment variable TTYNUMBER in .bash_profile - Then use this in the script, to establish what tty I'm working with. Thanks --

Re: python and vc numbers

2009-12-01 Thread Lie Ryan
On 11/30/2009 10:05 PM, Daniel Dalton wrote: On Mon, Nov 30, 2009 at 02:26:14AM -0800, Chris Rebert wrote: Also, in my quickie newbie experimentation with `screen`, each screen window seems to get a unique tty#. Admittedly I am running OS X Can you make do with the tempfile module? Or you'd

Re: python and vc numbers

2009-11-30 Thread Daniel Dalton
On Mon, Nov 30, 2009 at 02:21:54PM +1300, Gregory Ewing wrote: I use to figure out what tty my program was invoked from? Here's one way: % python Python 2.5 (r25:51908, Apr 8 2007, 22:22:18) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Type help, copyright, credits or

Re: python and vc numbers

2009-11-30 Thread Daniel Dalton
On Mon, Nov 30, 2009 at 07:20:59PM +1100, Daniel Dalton wrote: That did the trick, thanks, after I append [-2] Further testing under screen says otherwise -- it seems to give me the tty number, not the virtual console number. Is there any way to figure out what virtual console I'm am in so a

Re: python and vc numbers

2009-11-30 Thread Chris Rebert
On Mon, Nov 30, 2009 at 2:02 AM, Daniel Dalton d.dal...@iinet.net.au wrote: On Mon, Nov 30, 2009 at 07:20:59PM +1100, Daniel Dalton wrote: That did the trick, thanks, after I append [-2] Further testing under screen says otherwise -- it seems to give me the tty number, not the virtual

Re: python and vc numbers

2009-11-30 Thread Daniel Dalton
On Mon, Nov 30, 2009 at 02:26:14AM -0800, Chris Rebert wrote: Also, in my quickie newbie experimentation with `screen`, each screen window seems to get a unique tty#. Admittedly I am running OS X Correct (Which creates the problem) Perhaps if you could explain your problem in greater detail?

Re: python and vc numbers

2009-11-30 Thread Gregory Ewing
Daniel Dalton wrote: I can't find a reliable way to determine the current console number with python or any bash tool. When I say console number, I mean the actual console number, not screen window or device it is sending to or whatever. You may be able to tell by looking at the DISPLAY

Re: python and vc numbers

2009-11-30 Thread Nobody
On Mon, 30 Nov 2009 21:02:00 +1100, Daniel Dalton wrote: That did the trick, thanks, after I append [-2] Further testing under screen says otherwise -- it seems to give me the tty number, not the virtual console number. Is there any way to figure out what virtual console I'm am in I'm

Re: python and vc numbers

2009-11-29 Thread Gregory Ewing
Daniel Dalton wrote: what function/module should I use to figure out what tty my program was invoked from? Here's one way: % python Python 2.5 (r25:51908, Apr 8 2007, 22:22:18) [GCC 3.3 20030304 (Apple Computer, Inc. build 1809)] on darwin Type help, copyright, credits or license for more

python and vc numbers

2009-11-28 Thread Daniel Dalton
Hi, I have a very simple problem, but I can't work out the answer. How do I return the current tty number in python? eg. what function/module should I use to figure out what tty my program was invoked from? Thanks -- Cheers, Dan http://members.iinet.net.au/~ddalton/ signature.asc