[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Python wrapper for gnu-screen
From: |
Artur Skonecki |
Subject: |
Re: Python wrapper for gnu-screen |
Date: |
Wed, 22 Sep 2010 19:10:41 +0200 (CEST) |
User-agent: |
Alpine 2.00 (DEB 1167 2008-08-23) |
Hi,
screenutils seems to be an interesting project. I would love to have a
python wrapper around Screen. It would be great if screenutils exposed
interface to every command and returned output if possible:
screenutils.command.screencommand(args,win)
I use this in my code:
def command_at(self,command,win="-1"):
if win=="-1":
win=""
else:
win="-p %s"%win
os.system('screen -S %s %s -X %s'% (self.pid,win,command))
l=self.get_lastmsg()
if l.startswith('Could not'):
#no such window
return -1
else:
return l
def get_number_and_title(self,win):
msg=self.command_at('number',win)
if msg==-1:
return -1,-1
number,title = msg.split("(",1)
number = number.strip().rsplit(' ',1)[1]
title = title.rsplit(")",1)[0]
return number,title
--
Artur Skonecki
http://adb.cba.pl
On Wed, 22 Sep 2010, Christophe, Jean-Charles Narbonne wrote:
Hi,
I'm a french student and I used screen to administrate server since a long time.
I've never made personal config files or search deep in all screen features but
I
developed for personal usage a lib in python for administration scripts.
(it's allow to inject code into the screens sessions, use monitoring ...).
I use it to automate things in shell flavored servers.
As I published this lib, I now ask for feedbacks from interested advenced screen
scripters/users/developers... Is this kind of tool interesting? Which feature
should be
added? Is the gnu-screen spirit respected?
Here the package and the doc:
http://pypi.python.org/pypi/screenutils
Here the Repository:
http://github.com/Christophe31/screenutils/
Here the main file:
http://github.com/Christophe31/screenutils/blob/master/screenutils/screen.py
--
Best regards,
Christophe Narbonne
http://blogs.dotnet-france.com/christophen/