473,545 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

python cgi problem with textarea

This may be more a cgi thing than a Python one, but I'm trying to get
this page:

http://adrian10.phpwebhosting.com/trial.html

consisting basically of this:

<FORM ACTION="/cgi-bin/python3.cgi" METHOD="POST">
<TEXTAREA NAME="essay" COLS=60 ROWS=20 WRAP=HARD></TEXTAREA>
<P><INPUT TYPE=SUBMIT VALUE="submit" NAME="submitbut ton">
</FORM>

....to print out the contents of the textarea with this cgi script:

#!/usr/bin/python
import cgi
print "Content-type: text/html\n"
form = cgi.FieldStorag e()
print form["essay"].value

....and I get an internal server error if I have any spaces in the
textarea, which is really going to limit its usefulness to me. Oddly,
it seems to work for a friend in the UK who's looked at it, but it
doesn't work for me here in Japan.

Apr 22 '07 #1
10 6055
On Apr 22, 4:08 pm, Adrian Smith <adrian_p_sm... @yahoo.comwrote :
This may be more a cgi thing than a Python one, but I'm trying to get
this page:

http://adrian10.phpwebhosting.com/trial.html

consisting basically of this:

<FORM ACTION="/cgi-bin/python3.cgi" METHOD="POST">
<TEXTAREA NAME="essay" COLS=60 ROWS=20 WRAP=HARD></TEXTAREA>
<P><INPUT TYPE=SUBMIT VALUE="submit" NAME="submitbut ton">
</FORM>

...to print out the contents of the textarea with this cgi script:

#!/usr/bin/python
import cgi
print "Content-type: text/html\n"
form = cgi.FieldStorag e()
print form["essay"].value

...and I get an internal server error if I have any spaces in the
textarea, which is really going to limit its usefulness to me. Oddly,
it seems to work for a friend in the UK who's looked at it, but it
doesn't work for me here in Japan.
i just tried it and its working. here it is

http://yallara.cs.rmit.edu.au/~bevcimen/form.html

maybe the internal server error is because mod_python isn't installed
assuming your using Apache as your web server

Cheers
Apr 22 '07 #2
Jim
On Apr 22, 2:08 am, Adrian Smith <adrian_p_sm... @yahoo.comwrote :
...and I get an internal server error if I have any spaces in the
textarea,
And what error appears in the server error log?

Apr 22 '07 #3
On Apr 22, 10:09 pm, placid <Bul...@gmail.c omwrote:
i just tried it and its working. here it is

http://yallara.cs.rmit.edu.au/~bevcimen/form.html

maybe the internal server error is because mod_python isn't installed
assuming your using Apache as your web server
Yeah, but it wouldn't work *at all* in that case, would it? ATM it
seems to work as long as the textarea input has no spaces.

Apr 22 '07 #4
On Apr 22, 11:40 pm, Jim <jim.heffe...@g mail.comwrote:
On Apr 22, 2:08 am, Adrian Smith <adrian_p_sm... @yahoo.comwrote :...and I
get an internal server error if I have any spaces in the textarea,

And what error appears in the server error log?
I've just asked my web provider why I don't appear to have a server
error log, as a matter of fact - I'll post it if and when they reply.

Apr 22 '07 #5
On Apr 22, 11:09 pm, placid <Bul...@gmail.c omwrote:
On Apr 22, 4:08 pm, Adrian Smith <adrian_p_sm... @yahoo.comwrote :
This may be more a cgi thing than a Python one, but I'm trying to get
this page:
http://adrian10.phpwebhosting.com/trial.html
consisting basically of this:
<FORM ACTION="/cgi-bin/python3.cgi" METHOD="POST">
<TEXTAREA NAME="essay" COLS=60 ROWS=20 WRAP=HARD></TEXTAREA>
<P><INPUT TYPE=SUBMIT VALUE="submit" NAME="submitbut ton">
</FORM>
...to print out the contents of the textarea with this cgi script:
#!/usr/bin/python
import cgi
print "Content-type: text/html\n"
form = cgi.FieldStorag e()
print form["essay"].value
...and I get an internal server error if I have any spaces in the
textarea, which is really going to limit its usefulness to me. Oddly,
it seems to work for a friend in the UK who's looked at it, but it
doesn't work for me here in Japan.

i just tried it and its working. here it is

http://yallara.cs.rmit.edu.au/~bevcimen/form.html

maybe the internal server error is because mod_python isn't installed
assuming your using Apache as your web server
You do not need mod_python installed to be able to run CGI scripts,
thus has nothing to do with mod_python.

Graham

Apr 22 '07 #6
On Apr 23, 1:01 am, Adrian Smith <adrian_p_sm... @yahoo.comwrote :
On Apr 22, 10:09 pm, placid <Bul...@gmail.c omwrote:
i just tried it and its working. here it is
http://yallara.cs.rmit.edu.au/~bevcimen/form.html
maybe the internal server error is because mod_python isn't installed
assuming your using Apache as your web server

Yeah, but it wouldn't work *at all* in that case, would it? ATM it
seems to work as long as the textarea input has no spaces.
it doest work because the "space" character isnt interpreted
correctly, you need
to change the space characters too &nbsp;

Cheers
Apr 23 '07 #7
Adrian Smith wrote:
...and I get an internal server error if I have any spaces in the
textarea, which is really going to limit its usefulness to me. Oddly,
While debugging you should put
#!/usr/bin/python
import cgitb
cgitb.enable()
import cgi
print "Content-type: text/html\n"
form = cgi.FieldStorag e()
print form["essay"].value
at the beginning of your cgi -- just in case the error is in the python
script.

Peter

Apr 23 '07 #8
placid <Bu****@gmail.c omwrote:
>On Apr 23, 1:01 am, Adrian Smith <adrian_p_sm... @yahoo.comwrote :
>On Apr 22, 10:09 pm, placid <Bul...@gmail.c omwrote:
i just tried it and its working. here it is
>http://yallara.cs.rmit.edu.au/~bevcimen/form.html
maybe the internal server error is because mod_python isn't installed
assuming your using Apache as your web server

Yeah, but it wouldn't work *at all* in that case, would it? ATM it
seems to work as long as the textarea input has no spaces.

it doest work because the "space" character isnt interpreted
correctly, you need to change the space characters too &nbsp;
What??? Did you even read the problem description?
--
Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Apr 24 '07 #9
On Apr 24, 4:52 pm, Tim Roberts <t...@probo.com wrote:
placid <Bul...@gmail.c omwrote:
On Apr 23, 1:01 am, Adrian Smith <adrian_p_sm... @yahoo.comwrote :
On Apr 22, 10:09 pm, placid <Bul...@gmail.c omwrote:
i just tried it and its working. here it is
http://yallara.cs.rmit.edu.au/~bevcimen/form.html
maybe the internal server error is because mod_python isn't installed
assuming your using Apache as your web server
Yeah, but it wouldn't work *at all* in that case, would it? ATM it
seems to work as long as the textarea input has no spaces.
it doest work because the "space" character isnt interpreted
correctly, you need to change the space characters too &nbsp;

What??? Did you even read the problem description?
oops...i did read the problem description, but i when i tried the code
it worked for me and when i put spaces into the TextArea it wasn't
reflected correctly back. So i thought this was the problem.

Adrian, can you still try replacing spaces with &nbsp; via the
following;

#!/usr/bin/python
import cgi
import urllib
import cgitb
cgitb.enable()
print "Content-type: text/html\n"
form = cgi.FieldStorag e()
#print urllib.quote_pl us(form["essay"].value)

for char in form["essay"].value:
if char == ' ':
print "&nbsp;"
else:
print char
Cheers

Apr 24 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1707
by: Taylor, Martin | last post by:
Limor Hevroni asked on Mon Apr 19 06:49:06 EDT 2004 if anyone was using Python for testing with TestDirector. I am doing this extensively and would welcome discussions with other people who are either doing it or are interested in doing it. Regards, C. Martin Taylor Sr. Test Automation Specialist Texas Instruments, Inc.
0
1213
by: Jason Giangrande | last post by:
The company I work for uses ASP and VBScript. I likely can not get them to change from ASP, but I thought that I might at least be able to convince them of a switch to ASP using Python. I am the only coder here and I know Python better than VB, though I am far from an expert in Python either. That said, I am getting better with VB, and have...
24
3110
by: Jean-Baptiste PERIN | last post by:
Hi, I'm trying to make a windows dll reachable from a python script .. and I'm encountering troubles during link step .. I use "lcc" to compile and link I use python 2.3 under win XP Here's the compile command which seems to work well : -----------------------------------------------------
0
2256
by: peter | last post by:
Hello all, I would like to debug my python libraries, written in c++, with GDB (gnu debugger) I'm using the mingw compiler in a windows environment. As development environment I use eclipse with the CDT plugin. This plugin also has a nice GUI frontend for the GDB. I've already tried several setups, no setup seemed to work.
9
2729
by: Paul Gorodyansky | last post by:
Hi, FAQ tells how to insert (or replace0 a text at a caret position in Mozilla (and same works for Opera 8+), for example, at http://www.faqts.com/knowledge_base/view.phtml/aid/1661 it talks about that - .... textControl.setSelectionRange(oldSelectionStart + newText.length, oldSelectionStart + newText.length);
8
4570
by: Joakim Persson | last post by:
Hello all. I am involved in a project where we have a desire to improve our software testing tools, and I'm in charge of looking for solutions regarding the logging of our software (originating from embedded devices). Currently, we are using a heavyweight, proprietary log tool developed by another part of the company. This tool contains all...
6
2987
by: Qun Cao | last post by:
Hi Everyone, I am a beginner on cross language development. My problem at hand is to build a python interface for a C++ application built on top of a 3D game engine. The purpose of this python interface is providing a convenient scripting toolkit for the application. One example is that a user can write a python script like: player =...
2
1801
by: dfj225 | last post by:
Hello All, A software project that I am working on currently has a C++ library that runs on a Beowulf cluster for parallel computation. The library code uses MPI for its implementation. We are currently developing python wrappers for the library. Our current design uses one Python process as a front end with processes created from the...
0
1242
by: Murat Gunduz | last post by:
Dear list member, I am using a Linux machine (Fedora Core 7, 64 bit): Linux 2.6.21-1.3228.fc7 #1 SMP Tue Jun 12 14:56:37 EDT 2007 x86_64 I tried to compile a software (ncvtk) with the simple command below % python setup.py install ERROR: could not import Tkinter.
4
5385
by: spectrumdt | last post by:
Hello. I am trying to extend Python with some C code. I made a trivial "Hello World" program in C that I am trying to wrap in "boilerplate" for inclusion in a Python program. But I can't compile the C code. The C compiler cannot find the required function `Py_BuildValue'. My C code looks like this:
0
7653
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
5965
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5322
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4942
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3444
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3439
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1871
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1012
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
695
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.