using CGI module on (slightly) hamstrung machines

Duncan Booth duncan at NOSPAMrcp.co.uk
Fri Aug 9 12:38:40 CEST 2002


Robert_NJ_Sykes at msn.co.uk (Rob Sykes) wrote in 
news:Xns92656E502E2B0robjohnrichardcouk at 192.168.0.246:

> So, two solutions are possible
> 
> 1) Including the modified CGI (as above) in the standard 
> distribution
> 
> 2) Moving the various quote/unquote functions out of urllib to
> 'somewhere else' and altering dependant files accordingly
> 
> 
> (There is also 3) get my ISP to make the necessary changes in their
> installation. I have e-mailed them to see if this can be done as 
> I'm sure that this will not effect only me)
> 

4) Fix it so you can import the existing files without changing any of 
them. What happens if you try this:
    	import sys, new
    	sys.modules['socket'] = new.module('socket')
    	import cgi

This should let you import cgi quite happily just so long as you don't try 
to use anything defined by socket.

Also 5) Upload the appropriate .so or .pyd to your system, add a directory 
to sys.path and just create sockets despite your ISP.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list