Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Re: VT100 in Python

Reply
Thread Tools

Re: VT100 in Python

 
 
Wolfgang Rohdewald
Guest
Posts: n/a
 
      09-14-2009
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
 
Reply With Quote
 
 
 
 
exarkun@twistedmatrix.com
Guest
Posts: n/a
 
      09-14-2009
On 09:29 am, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>Wolfgang Rohdewald <(E-Mail Removed)> 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/c...Transport.html

http://twistedmatrix.com/documents/c...lProtocol.html

http://twistedmatrix.com/projects/co...tion/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
 
Reply With Quote
 
 
 
 
Nobody
Guest
Posts: n/a
 
      09-17-2009
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Curses - how can I print the VT100 symbols such as ACS_DIAMOND andACS_BULLET Grehom Perl Misc 0 03-17-2008 10:30 AM
Curses for win32 with VT100/ANSI support Daniele C. C Programming 48 06-08-2006 02:11 AM
Addressing the cursor of a VT100 style terminal emulator using perl Jeff Silverman Perl Misc 2 12-29-2005 01:10 PM
Python and VT100 Dominique Bouré Python 2 03-06-2005 12:02 AM
VT100 Free Doc C Programming 1 04-30-2004 11:28 AM



Advertisments