Chris,<br clear="all"><span style="font-family:arial,helvetica,sans-serif"><br>Wow, that seems so simple now that I see it.  I was dancing around that all day, but just not landing on it.   Thanks so very much for the assist.<br>

<br></span>--Bill<br><br>Final code that works perfectly, passes the value from the Python script to the javascript correctly:<br><br>#!/usr/bin/python<br>import json, os, cgi, cgitb<br>cgitb.enable()<br><br>pid_data = str(os.getpid())<br>

<br>print "Content-type: text/html"<br>print<br><br>print """ <br><html><br><head><title>Test Page</title><br><script type="text/javascript"><br>function showPID(pid){<br>

<br>document.getElementById('txt').innerHTML="js: "+pid;<br>}<br></script><br></head><br><body onload="showPID("""+pid_data+""")"><br><br>Hello World!<br><br><br>

<div id="txt"></div><br><br>"""<br>print "html: "+pid_data+"<br>"<br>print """<br></body><br></html>"""<br><br>

Output of above code is the following, which is just the PID of the Python CGI itself at runtime, displayed via javascript and via HTML.<br>Hello World!<br><br>
<div id="txt">js: 1308</div><br>

html: 1308<br><br>
<br><br><div class="gmail_quote">On Wed, Oct 26, 2011 at 21:42, Chris Rebert <span dir="ltr"><<a href="mailto:clp2@rebertia.com">clp2@rebertia.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

<div class="im">On Wed, Oct 26, 2011 at 7:25 PM, Bill Allen <<a href="mailto:wallenpb@gmail.com">wallenpb@gmail.com</a>> wrote:<br>
<br>
</div>The problem is that you're not passing the data at all. You never<br>
interpolate the pid_data value into the string(s) constituting your<br>
embedded JavaScript (though you did do it just fine in the pure HTML).<br>
The Python variable `pid_data` is not somehow magically accessible to<br>
JavaScript; you must explicitly insert its value somewhere.<br>
<br>
<snip><br>
> pid_data = str(os.getpid())<br>
<snip><br>
> print """<br>
<snip><br>
> <body onload="showPID(pid_data)"><br>
<br>
Change that line to:<br>
<body onload="showPID("""+pid_data+""")"><br>
<br>
As an example, if the PID happens to be 42, then the outputted<br>
fragment will end up being:<br>
<body onload="showPID(42)"><br>
<br>
As a sidenote, I would recommend using something higher-level than the<br>
`cgi` module. Python has an abundance of web frameworks and templating<br>
languages; take your pick.<br>
<br>
Cheers,<br>
Chris<br>
<font color="#888888">--<br>
<a href="http://rebertia.com" target="_blank">http://rebertia.com</a><br>
</font></blockquote></div><br>