Python code cycle:

Source (.py) -> Byte Code (.pyc ) -> PVM

Using env lookup to run code:

#!/usr/bin/env python
...
...

Sample code

import os, time, sys
from socket import *

my_host = ''
my_port = 4000
active_kids = []

sockobj = socket (AF_INET, SOCK_STREAM)
sockobj.bind ((my_host, my_port))
sockobj.listen (5)

# ----------- defs ------------

def now ():
  return time.ctime(time.time())

def grim_reaper ():
  while active_kids:
    pid, stat = os.waitpid (0, os.WNOHANG)
    if not pid: break
    active_kids.remove (pid)

def responder (conn):
  time.sleep (1)

  while 1:
    data = conn.recv (1024)
    if not data: break

    conn.send ('Echo: %s at %s' % (data, now()))

  connection.close ()
  os._exit (0)

def dispatcher ():
  conn, address = sockobj.accept ()

  print 'Server %s connected at %s' % (address, now())
  grim_reaper ()
  childpid = os.fork ()

  if childpid == 0:
    responder (conn)
  else:
    active_kids.append (pid)


# Dispatch...

dispatcher ()

PHP Warnings

lib/pear/DB/common.php:741: Notice[8]: Only variable references should be returned by reference

lib/pear/DB/common.php:741: Notice[8]: Only variable references should be returned by reference

lib/Template.php:106: Notice[8]: Only variables should be assigned by reference

lib/Template.php:107: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'body'?)(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'body'?)(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'body'?)(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'body'?)(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'body'?)(In template 'htmldump'?):106: Notice[8]: Only variables should be assigned by reference

lib/Template.php(In template 'body'?)(In template 'htmldump'?):107: Notice[8]: Only variables should be assigned by reference