[PythonCE] Unix->CE. Telnet into your PythonCE !

Telion telionce@yahoo.com
Fri, 29 Nov 2002 10:09:19 -0800 (PST)

--- Olivier Fambon <Olivier.Fambon@xrce.xerox.com> wrote:
> Hi there,
> I don't know if it might be of any use to you WindoZ-enabled people...
> Might be trivial too. However, I can share my practice here
> [and may be update the Wiki pages ?]
> Enjoy.
> A+O.
> For people who have no Windows+ActiveSync machine at hand, only an
> iPaq+WLan.
> 1/ Install
> To install PythonCE, downloaded the cab via IE. As long as you can
> stick the cab on some [Wlan-accessible] web server (*), it's fine.
> The plot is that you have no "save-as" in IE... However, browsed files
> are stored locally in /Windows/Temporary Internet Files/<some nice name>
> There are several <some nice name> tmp dirs. Spot the one containing
> the cab with File Exploder, and click the cab.
> 2/ Testing/Running scripts
> You can develop scripts on a host, serve them via a web server, and
> execute them via IE.
> Just set the mime-type for .py files to application/python, and IE
> will run Python for you.

I don't recommend doing this.
Someone may setup a web page with very nasty python code for you.

Rather than that, IE will ask for 
   Execute with associated program,
   Save that file.
for most unknown type.

If you are testing the script you made,
you can simply choose to execute,
providing .py and .pyc is associated with Python
in the registry.

> Mime-types are in web.xml for Tomcat, or use (*) SimpleHTTPServer as
> web-server and hack the mime-types mappings [see trace bellow]
> > Python 2.2.2 (#2, Nov 19 2002, 14:36:35) 
> [GCC 3.2] on sunos5
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import SimpleHTTPServer
> >>>
> >>> SimpleHTTPServer.test()
> Serving HTTP on port 8000 ...
> > 
> 3/ Handy Python prompt
> In case you would like to have a usable python prompt - and a
> keyboard, you can telnet into your PythonCE.
> Just run pysrv.py on your PythonCE [see script bellow], and telnet
> into it [or use a python telnet-client like for history may be].
> The script is a modified [and not-fully-ok ] copy/paste from
> Python-1.5.2/Demo/pysvr/pysvr.py
> Note that there are other [non-threaded] such server scripts out there
> which might work better...

You should be very careful if your machine is connected to Lan/Wan.

I would not run pysvr and any other server script unless;
   my machine is not connected,
   or script has adequate security measure.

If you add these lines;

  if not addr[0]=="": 
    print "Bad addr", addr

right after 

  (conn, addr) = sock.accept

it would be safer.

You can add any safe address, too.
  if addr[0]!="" and addr[0][:6]!="192.168": 

- telionce@yahoo.com -

Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.