[Tutor] Telnet and special characters

Johan Geldenhuys johan at accesstel.co.za
Wed Feb 28 13:55:33 CET 2007


 I have used special characters before in Telnet sessions, but always use
hex characters. i.e.: \x0B for ESC.

Maybe F-keys are some form of internal OS signals and are not send out on
the network connection. In that case, I'm not sure how to send it.

Johan

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On Behalf
Of Luke Paireepinart
Sent: 27 February 2007 09:57 PM
To: Chris Hallman
Cc: tutor at python.org
Subject: Re: [Tutor] Telnet and special characters

Chris Hallman wrote:
>
> Is it possible to send a F1 "character" over a telnet connection? I've 
> searched but I can't find a solution. I've tried SendKeys 
> <http://www.rutherfurd.net/python/sendkeys/> and other methods, but I 
> can't get it to work.
>
> import telnetlib
>
> pswd = "***"
> host = "***"
> tn = telnetlib.Telnet(host)
> tn.read_until("password:", 7)
> tn.write(pswd + "\n")
> tn.write(chr(27)) # ESC
> tn.write (chr(78)) # Shift N
> tn.write(chr(25)) # Down arrow
You could have a special sequence of characters that wouldn't normally be
used, like \1\1\2\3\1\2\4, and if the server receives this, you can use
pyHook or something to generate a keypress on the other end.
It seems to me that the function keys would have a value too.
I don't have time to investigate the matter further currently, I'll try to
look into it later.
-Luke
>
>
> ----------------------------------------------------------------------
> --
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>   

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor

--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.441 / Virus Database: 268.18.3/698 - Release Date: 2007/02/23
04:39 AM
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.4/703 - Release Date: 2007/02/26
02:56 PM
 



More information about the Tutor mailing list