473,327 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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="submitbutton">
</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.FieldStorage()
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 6043
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="submitbutton">
</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.FieldStorage()
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.comwrote:
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...@gmail.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.comwrote:
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="submitbutton">
</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.FieldStorage()
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.comwrote:
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.FieldStorage()
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.comwrote:
>On Apr 23, 1:01 am, Adrian Smith <adrian_p_sm...@yahoo.comwrote:
>On Apr 22, 10:09 pm, placid <Bul...@gmail.comwrote:
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.comwrote:
placid <Bul...@gmail.comwrote:
On Apr 23, 1:01 am, Adrian Smith <adrian_p_sm...@yahoo.comwrote:
On Apr 22, 10:09 pm, placid <Bul...@gmail.comwrote:
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.FieldStorage()
#print urllib.quote_plus(form["essay"].value)

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

Apr 24 '07 #10
On Apr 24, 8:00 pm, placid <Bul...@gmail.comwrote:
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.FieldStorage()
#print urllib.quote_plus(form["essay"].value)

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

Cheers
I'll try it...but I think it may be a problem on the server end. It's
not showing up in the server logs, either.

Apr 24 '07 #11

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

Similar topics

2
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...
0
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...
24
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 ...
0
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...
9
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...
8
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...
6
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...
2
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...
0
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...
4
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.