screen scraping with Python?

Michael Hudson mwh at python.net
Mon Aug 5 12:04:15 CEST 2002


noah at noah.org (Noah) writes:

> Does anyone know of a Python terminal emulator? 
> I need VT100, ANSI, VT220, or something like that.

No.

> I want to use it for screen scraping purposes. Basically I want to
> take a stream of text that includes vt-100 codes and send it to some
> objects that will interprets the codes and map text to a buffer.
> The buffer will be an array model of a screen.  Then my application
> will get characters from the buffer using X,Y coordinates.  This is
> to create a non-interactive application that will run as a service
> or from cron, so it will not have a controlling terminal.
> 
> Has anyone done anything like this? Is there some  
> terminal emulation module for Python? 

If you're preapred to dig into someone else's fairly hairy code, my
pyrepl package contains what I think is quite a nice infrastructure
for recognising escape codes.

    http://starship.python.net/crew/mwh/hacks/pyrepl.html

Look in unix_keymap.py, unix_console.py.

In pyrepl I use to recognise keystrokes, but I think it would work to
pick out VT100 codes too.

> I'm about ready to write my own...

I'd be interested if you came up with anything!  (I was one of the
people talking to Holger at EuroPython).

Cheers,
M.

-- 
  I'm not sure that the ability to create routing diagrams 
  similar to pretzels with mad cow disease is actually a 
  marketable skill.                                     -- Steve Levin
               -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html



More information about the Python-list mailing list