using CGI module on (slightly) hamstrung machines

Rob Sykes Robert_NJ_Sykes at
Fri Aug 9 14:16:52 CEST 2002

Duncan Booth <duncan at> wrote in
news:Xns926574BB96D85duncanrcpcouk at 

> Robert_NJ_Sykes at (Rob Sykes) wrote in 
> news:Xns92656E502E2B0robjohnrichardcouk at
>> 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.

OK. That looks practical (he says, having hurriedly looked up
the new module). It does look rather meta-'something' though. Am
I already that clever with Python?

I'm still a bit (in theory) unhappy with the module dependancy in 
CGI. I'm not sure that importing a module for the explicit purpose 
of text editing should have the side effects that urllib brings. 
Mind you, this is the 'Real World'. It is also the 1st time that
I've found *anything* to gripe about when using Python (in 6 months 
so far)

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

Surely, you're not suggesting I should break my ISP's TOC ;-)

Rob Sykes 

Born again Bairn                  | 'The despair I can live with.
rob at john-richard dot co dot uk |  It's the hope I can't stand' 
(header email for spambots)

More information about the Python-list mailing list