Help: I want a chat script!

Philip Swartzleonard starx at pacbell.net
Fri Feb 8 20:04:02 EST 2002


Flavian Hardcastle || Fri 08 Feb 2002 04:23:16p:

> Ello. I'm a newbie programmer using the Python language. I've recently 
> completed a couple of the Python beginner's tutorials out there on the
> web (Josh Cagliati's, and Richard Baldwin's).
> 
> I have this ambitious idea for a project. I want to make my own browser
> based chat room. 
> 
> It seems simple. I basically wrote a little Python subroutine which
> takes input via the Python IDE, and writes a little html document using
> IO commands. Voila! Un chat program! Albeit an extremely simple one at
> first. Now if I could just train the little bugger to take input from a
> web browser I'd be in business. I figured the easiest way to do this
> was to write an html form that writes the input to a text or dat file,
> and my prog can extract the data from that and print it back to web
> page 
> 
> But ... I can't find any easy way to do that, to my suprise. I tried 
> looking through all the html tutorials for information about forms. The
> nearest I could come to, specific to my requirements, was tutorials on
> how to set up your own messageboard. Apparantly, I have to get a web
> server that supports CGI (whatever that is), use a telnet
> client(whatever that is) to connect to it. I also have to learn PERL
> (What? A whole new programming language?), and ideally the server
> should be UNIX (A whole new operating system?).
> 
> I can't believe I have to learn 4 things at once just to get to get
> input from a browser! Surely there must be an easier way to do it?
> 
> If I could,  I would much rather be able to have the script on my PC,
> use my personal web server to host it. Then I'd invite a net buddy or
> two into it to help me perfect the script. And then I might think about
> actually putting the room on a proper server, if I don't lose interest
> in the project by then.

Well, as far as i can remeber, CGI is just an interface, you can use it 
with Perl or Python or C or whatever. You probably will have to learn it, 
but it should just be a modlue and some extra commands IN python... and 
you'll have to configure whatever web server you're using to use CGI 
program, that's probaly the hard part.

As for perl, well, a lot of CGI-based things happen to be written in perl 
(i think), which is probably why those tutorials said 'learn perl'. You 
don't need to.

Telnet is just a program -- all you have to know is how to put a server's 
address and port number into it, after that, it's either something just 
like a dos window for a remote unix system, or a mud interface ;). And for 
what you would have to do to manage your files on unix, well, you might 
need mv, cp, rm, mkdir, cd, ls/dir, and maybe chmod, chown, chgrp... a 
total of 10 commands, at least 5 of which are almost no-brainers (cd, 
mv=move, cp=copy, rm=del, mkdir ... ls has lots of switches, some are good 
:)

Anyway, you'd only need unix sometimes if you used that kind of server, and 
you don't even want a server... if you can get your computer to run CGI's, 
and check out 11.2 (or so) of the library reference manual for the CGI 
commands, you should be most of the way there.

Sorry for the longness :)


-- 
Philip Sw "Starweaver" [rasx] :: www.rubydragon.com



More information about the Python-list mailing list