Hi again.

I'm putting together a little project with R, python, and a website.  So I
have an HTML file, a py file, an R file.

Here is the HTML file:
<form action="/cgi-bin/radio4.py" method="post" target="_blank">
<input type="radio" name="subject" value="Integrate" /> Integrate
<input type="radio" name="subject" value="Differentiate" /> Differentiate
<input type="radio" name="subject" value="Graph" /> Graph
Function <input type="text"  name="func1" <br />
<input type="submit" value="Select Subject" />
</form>

Now the radio4.py file:

# Import modules for CGI handling
import cgi, cgitb
from sympy import *
import sys

from rpy2.robjects.packages import SignatureTranslatedAnonymousPackage as
STAP
with open("bz2.R","r") as f:
    string=''.join(f.readlines())
etest = STAP(string,"etest")
etest.etest(500)


# Create instance of FieldStorage
form = cgi.FieldStorage()

# Get data from fields
if form.getvalue('subject'):
   subject = form.getvalue('subject')
else:
   subject = "Not set"

if form.getvalue('func1'):
   func1 = form.getvalue('func1')
else:
   func1 = "Not entered"





print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Test Project</title>"
print "</head>"
print "<body>"
print "<h2> Selected Action is %s</h2>" % subject
print "<h3> output function is %s</h3>" % func1
print "</body>"
print "</html>"


Finally, the bz2.R file:

etest <- function(n=100) {
    y <- rnorm(n)
    pdf(file="lap1.png")
    plot(y)
    dev.off()
}


The radio4.py file is in a cgi-bin directory, along with the bz2.R file.

I keep getting the Internal server error.

Thanks for any help.

Sincerely,
Erin

This is R version 3.0.2 and Python 2.7.5

-- 
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodg...@gmail.com

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to