<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CRHINKE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CDOCUME%7E1%5CRHINKE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5CRHINKE%7E1%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:1;
        mso-generic-font-family:roman;
        mso-font-format:other;
        mso-font-pitch:variable;
        mso-font-signature:0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-fareast-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;
        text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-noshow:yes;
        mso-style-priority:99;
        color:purple;
        mso-themecolor:followedhyperlink;
        text-decoration:underline;
        text-underline:single;}
code
        {mso-style-noshow:yes;
        mso-style-priority:99;
        font-family:"Courier New";
        mso-ascii-font-family:"Courier New";
        mso-fareast-font-family:Calibri;
        mso-fareast-theme-font:minor-latin;
        mso-hansi-font-family:"Courier New";
        mso-bidi-font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        font-size:10.0pt;
        mso-ansi-font-size:10.0pt;
        mso-bidi-font-size:10.0pt;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
<p class="MsoNormal" style="margin-bottom: 12pt;">My script doesn't want to
recognize the variables from the exec() command in PHP. Plus, it won't capture
the results of the script.<br>
<br>
This Python script works in IDLE, and I've got some testing code in there.<br>
<br>
One Known Unsolved Issue:<br>
I put Python in C:\Program Files\Python26\python.exe and have tried<br>
$command = "C:\Program Files\Python26\python.exe include/weatherFeed.py -c
$city -s $state";<br>
to no avail.</p>
<p class="MsoNormal" style="margin-bottom: 12pt;">I added .py to Windows IIS Web
Service Extensions and to the Application Configuration.<br>
<br>
Any help appreciated.</p>
<p class="MsoNormal">[code]</p>
<p class="MsoNormal" style="margin-left: 0.5in;"><code><span style="font-size: 10pt;">#!C:\Program
Files\Python26\python.exe -u</span></code><span style="font-size: 10pt; font-family: "Courier New";"><br>
<code># Current weather feed</code><br>
<code># # Weather page sources: <a href="http://www.weather.gov/">http://www.weather.gov/</a></code><br>
<code># Capture relevant data, strip unusable stuff out, fix URLs, display in
our HTML page</code><br>
<br>
<code># import program modules</code><br>
<code>import mechanize, re, urllib2, sys # 'standard' set</code><br>
<code>from BeautifulSoup import BeautifulSoup as B_S</code><br>
<br>
<code>query = 'Chicago, IL' #test to make sure script works!</code><br>
<code>city = 'Establish'</code><br>
<code>state = 'Variables'</code><br>
<code>count = 0</code><br>
<code>for ea in sys.argv:</code><br>
<code> if ea == '-c':</code><br>
<code> city = sys.argv[count+1]</code><br>
<code> elif ea == '-s':</code><br>
<code> state = sys.argv[count+1]</code><br>
<code> count+=1</code><br>
<code>cityState = city + ', ' + state</code><br>
<br>
<code>_URL = "<a href="http://www.weather.gov/">http://www.weather.gov/</a>"</code><br>
<code>#_URL = "<a href="http://forecast.weather.gov/MapClick.php?CityName=Novato&state=CA&site=MTR&lat=38.1032&lon=-122.63">http://forecast.weather.gov/MapClick.php?CityName=Novato&state=CA&site=MTR&lat=38.1032&lon=-122.63</a>"</code><br>
<br>
<code>br=mechanize.Browser()</code><br>
<code>br.open( _URL )</code><br>
<code>br.select_form( nr=1 ) #assuming form is 2nd form on page</code><br>
<code>br['inputstring'] = query</code><br>
<code>html = br.submit()</code><br>
<br>
<code>_soup = B_S(html)</code><br>
<br>
<code># finding the correct table</code><br>
<code>_step1 = _soup.findAll('table', limit=7)[6]</code><br>
<code>col = _step1.findAll('td')</code><br>
<code>_thumb = '<table><tr><td colspan=2>Forecast for ' +
query + '<br>' + str(sys.argv) + '</td></tr><tr>' +
str(col[0]) + str(col[1]) + '</tr></table>'</code><br>
<code>_thumb = _thumb.replace( '11%','50%' )</code><br>
<code>_thumb = _thumb.replace( '/images/', 'images/weather/' )</code><br>
<br>
<code>#write to txt file TEST</code><br>
<code>_temp = 'D:\\Inetpub\\AtoZ\\hometown\\include\\weatherFeed_TEMP.txt'</code><br>
<code>temp = open( _temp, 'w' )</code><br>
<code>temp.write( _thumb )</code><br>
<code>temp.close()</code><br>
<br>
<code>#print _thumb</code></span></p>
<p class="MsoNormal">[/code]<br>
<br>
And my PHP:</p>
<p class="MsoNormal">[code]</p>
<p class="MsoNormal" style="margin-left: 0.5in;"><code><span style="font-size: 10pt;"><?PHP</span></code><span style="font-size: 10pt; font-family: "Courier New";"><br>
<code> $city = 'Tampa';</code><br>
<code> $state = 'FL';</code><br>
<code> echo '<p><p>Python Weather
Feed for ' . $city . ', ' . $state . '<p>';</code><br>
<br>
<code> ob_start();</code><br>
<code> $command = "include/weatherFeed.py -c
" . $city . "-s " . $state;</code><br>
<code> exec($command);</code><br>
<code> $content=ob_get_contents();</code><br>
<code> ob_end_clean();</code><br>
<code> </code><br>
<code> echo 'Content: ' . $content . '<br>';</code><br>
<code> echo 'Result: ' . $result . '<br>';</code><br>
<code> echo 'Data: ' . $data . '<br>';</code><br>
<code> include('include\weatherFeed_TEMP.txt')</code><br>
<code> ?></code></span></p>
<p class="MsoNormal"> </p>
<div style="visibility: hidden; display: inline;" id="avg_ls_inline_popup"></div><style type="text/css">#avg_ls_inline_popup { position:absolute; z-index:9999; padding: 0px 0px; margin-left: 0px; margin-top: 0px; width: 240px; overflow: hidden; word-wrap: break-word; color: black; font-size: 10px; text-align: left; line-height: 13px;}</style>