Re: VT100 in Python

2009-09-17 Thread Nobody
On Mon, 14 Sep 2009 04:29:57 -0500, Nick Craig-Wood wrote:

 At a basic level parsing VT100 is quite easy, so you can get rid of
 the VT100 control.  They start with ESC, have other characters in the
 middle then end with a letter (upper or lowercase), so a regexp will
 make short work of them.  Something like r\x1B[^A-Za-z]*[A-Za-z]

While this pattern is common, unfortunately there are some exceptions.

Also, vt100 has become a generic term for terminal emulation. There
is no guarantee that the OP actually wants to parse vt100 escapes and
nothing else.

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


Re: VT100 in Python

2009-09-15 Thread Grant Edwards
On 2009-09-14, Wolfgang Rohdewald wolfg...@rohdewald.de wrote:

 that should be easy using regular expressions

And they say irony doesn't work well on Usenet!

-- 
Grant Edwards   grante Yow! My nose feels like a
  at   bad Ronald Reagan movie ...
   visi.com
-- 
http://mail.python.org/mailman/listinfo/python-list


VT100 in Python

2009-09-14 Thread Nadav Chernin
Hi, everybody

 

I'm writing program that read data from some instrument trough RS232.
This instrument send data in VT100 format. I need only to extract the
text without all other characters that describe how to represent data on
the screen. Is there some library in python for converting VT100
strings?

 

Thanks, Nadav

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


Re: VT100 in Python

2009-09-14 Thread Wolfgang Rohdewald
On Sunday 13 September 2009, Nadav Chernin wrote:
 I'm writing program that read data from some instrument trough
  RS232. This instrument send data in VT100 format. I need only to
  extract the text without all other characters that describe how to
  represent data on the screen. Is there some library in python for
  converting VT100 strings?
 

that should be easy using regular expressions

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


Re: VT100 in Python

2009-09-14 Thread Nick Craig-Wood
Wolfgang Rohdewald wolfg...@rohdewald.de wrote:
  On Sunday 13 September 2009, Nadav Chernin wrote:
  I'm writing program that read data from some instrument trough
   RS232. This instrument send data in VT100 format. I need only to
   extract the text without all other characters that describe how to
   represent data on the screen. Is there some library in python for
   converting VT100 strings?
 
  that should be easy using regular expressions

At a basic level parsing VT100 is quite easy, so you can get rid of
the VT100 control.  They start with ESC, have other characters in the
middle then end with a letter (upper or lowercase), so a regexp will
make short work of them.  Something like r\x1B[^A-Za-z]*[A-Za-z]

You might need to parse the VT100 stream as VT100 builds up a screen
buffer though and the commands don't always come out in the order you
might expect.

I think twisted has VT100 emulator, but I couldn't find it in a brief
search just now.

You'll find various others (like this one) if you search some more

http://svn.python.org/projects/python/branches/string_methods/Demo/cwilib/vt100.py

-- 
Nick Craig-Wood n...@craig-wood.com -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: VT100 in Python

2009-09-14 Thread exarkun

On 09:29 am, n...@craig-wood.com wrote:

Wolfgang Rohdewald wolfg...@rohdewald.de wrote:

 On Sunday 13 September 2009, Nadav Chernin wrote:
 I'm writing program that read data from some instrument trough
  RS232. This instrument send data in VT100 format. I need only to
  extract the text without all other characters that describe how to
  represent data on the screen. Is there some library in python for
  converting VT100 strings?

 that should be easy using regular expressions


At a basic level parsing VT100 is quite easy, so you can get rid of
the VT100 control.  They start with ESC, have other characters in the
middle then end with a letter (upper or lowercase), so a regexp will
make short work of them.  Something like r\x1B[^A-Za-z]*[A-Za-z]

You might need to parse the VT100 stream as VT100 builds up a screen
buffer though and the commands don't always come out in the order you
might expect.

I think twisted has VT100 emulator, but I couldn't find it in a brief
search just now.


Yep, though it's one of the parts of Twisted that only has API 
documentation and a few examples, no expository prose-style docs.  If 
you're feeling brave, though:


http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalTransport.html

http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalProtocol.html

 http://twistedmatrix.com/projects/conch/documentation/examples/ (the 
insults section)


It's not really all that complicated, but without adequate docs it can 
still be tricky to figure things out.  There's almost always someone on 
IRC (#twisted on freenode) to offer real-time help, though.


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


Re: VT100 in Python

2009-09-14 Thread bouncy...@gmail.com


I hate to ask but what kind of device.and what`s with all the `insult` 
strings? - gimmick?

--Original Message--
From: exar...@twistedmatrix.com
To: python-list@python.org
Date: Mon, 14 Sep 2009 01:43:11 PM +
Subject: Re: VT100 in Python

On 09:29 am, n...@craig-wood.com wrote:
Wolfgang Rohdewald wolfg...@rohdewald.de wrote:
  On Sunday 13 September 2009, Nadav Chernin wrote:
  I'm writing program that read data from some instrument trough
   RS232. This instrument send data in VT100 format. I need only to
   extract the text without all other characters that describe how to
   represent data on the screen. Is there some library in python for
   converting VT100 strings?

  that should be easy using regular expressions

At a basic level parsing VT100 is quite easy, so you can get rid of
the VT100 control.  They start with ESC, have other characters in the
middle then end with a letter (upper or lowercase), so a regexp will
make short work of them.  Something like r\x1B[^A-Za-z]*[A-Za-z]

You might need to parse the VT100 stream as VT100 builds up a screen
buffer though and the commands don't always come out in the order you
might expect.

I think twisted has VT100 emulator, but I couldn't find it in a brief
search just now.

Yep, though it's one of the parts of Twisted that only has API 
documentation and a few examples, no expository prose-style docs.  If 
you're feeling brave, though:

http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalTransport.html

http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalProtocol.html

  http://twistedmatrix.com/projects/conch/documentation/examples/ (the 
insults section)

It's not really all that complicated, but without adequate docs it can 
still be tricky to figure things out.  There's almost always someone on 
IRC (#twisted on freenode) to offer real-time help, though.

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

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


Re: VT100 in Python

2009-09-14 Thread Jerry Hill
On Mon, Sep 14, 2009 at 10:58 PM, bouncy...@gmail.com
bouncy...@gmail.com wrote:
 From: exar...@twistedmatrix.com
 http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalTransport.html
 http://twistedmatrix.com/documents/current/api/twisted.conch.insults.insults.ITerminalProtocol.html

  http://twistedmatrix.com/projects/conch/documentation/examples/ (the
 insults section)

  what`s with all the `insult` strings? - gimmick?

I think that 'insults' is twisted's replacement for curses.

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