FAQ
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.

This Python script works in IDLE, and I've got some testing code in there.

One Known Unsolved Issue:
I put Python in C:\Program Files\Python26\python.exe and have tried
$command = "C:\Program Files\Python26\python.exe include/weatherFeed.py -c
$city -s $state";
to no avail.

I added .py to Windows IIS Web Service Extensions and to the Application
Configuration.

Any help appreciated.

[code]

#!C:\Program Files\Python26\python.exe -u
# Current weather feed
# # Weather page sources: http://www.weather.gov/
# Capture relevant data, strip unusable stuff out, fix URLs, display in our
HTML page

# import program modules
import mechanize, re, urllib2, sys # 'standard' set
from BeautifulSoup import BeautifulSoup as B_S

query = 'Chicago, IL' #test to make sure script works!
city = 'Establish'
state = 'Variables'
count = 0
for ea in sys.argv:
if ea == '-c':
city = sys.argv[count+1]
elif ea == '-s':
state = sys.argv[count+1]
count+=1
cityState = city + ', ' + state

_URL = "http://www.weather.gov/"
#_URL "http://forecast.weather.gov/MapClick.php?CityName=Novato&stateÊ&site=MTR&
lat8.1032&lon=-122.63"

br=mechanize.Browser()
br.open( _URL )
br.select_form( nr=1 ) #assuming form is 2nd form on page
br['inputstring'] = query
html = br.submit()

_soup = B_S(html)

# finding the correct table
_step1 = _soup.findAll('table', limit=7)[6]
col = _step1.findAll('td')
_thumb = '<table><tr><td colspan=2>Forecast for ' + query + '<br>' +
str(sys.argv) + '</td></tr><tr>' + str(col[0]) + str(col[1]) +
'</tr></table>'
_thumb = _thumb.replace( '11%','50%' )
_thumb = _thumb.replace( '/images/', 'images/weather/' )

#write to txt file TEST
_temp = 'D:\\Inetpub\\AtoZ\\hometown\\include\\weatherFeed_TEMP.txt'
temp = open( _temp, 'w' )
temp.write( _thumb )
temp.close()

#print _thumb

[/code]

And my PHP:

[code]

<?PHP
$city = 'Tampa';
$state = 'FL';
echo '<p><p>Python Weather Feed for ' . $city . ', ' . $state .
'<p>';

ob_start();
$command = "include/weatherFeed.py -c " . $city . "-s " . $state;
exec($command);
$content=ob_get_contents();
ob_end_clean();

echo 'Content: ' . $content . '<br>';
echo 'Result: ' . $result . '<br>';
echo 'Data: ' . $data . '<br>';
include('include\weatherFeed_TEMP.txt')
?>





Roy Hinkelman
Technical Services
Website Development & Management
707-774-7411
<mailto:roy at worldtradepress.com> roy at worldtradepress.com
________________________________
www.WorldTradePress.com (main website)
www.StockMapAgency.com (3700+ Antique & Modern Maps)
www.BestCountryReports.com (country reports for 175 countries)
www.GiantMapArt.com (giant wall maps)
www.WorldTradeRef.com (trade and logistics)
www.GlobalRoadWarrior.com (175-country database)
www.AtoZMapsOnline.com (worlds largest map database)
<http://www.AtoZtheUSA.com> www.AtoZtheUSA.com (extensive state facts
database)



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101022/4c9b4266/attachment.html>

Search Discussions

  • Roy Hinkelman at Oct 22, 2010 at 6:52 pm
    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.

    This Python script works in IDLE, and I've got some testing code in there.

    One Known Unsolved Issue:
    I put Python in C:\Program Files\Python26\python.exe and have tried
    $command = "C:\Program Files\Python26\python.exe include/weatherFeed.py -c
    $city -s $state";
    to no avail.

    I added .py to Windows IIS Web Service Extensions and to the Application
    Configuration.

    Any help appreciated.

    [code]

    #!C:\Program Files\Python26\python.exe -u
    # Current weather feed
    # # Weather page sources: http://www.weather.gov/
    # Capture relevant data, strip unusable stuff out, fix URLs, display in our
    HTML page

    # import program modules
    import mechanize, re, urllib2, sys # 'standard' set
    from BeautifulSoup import BeautifulSoup as B_S

    query = 'Chicago, IL' #test to make sure script works!
    city = 'Establish'
    state = 'Variables'
    count = 0
    for ea in sys.argv:
    if ea == '-c':
    city = sys.argv[count+1]
    elif ea == '-s':
    state = sys.argv[count+1]
    count+=1
    cityState = city + ', ' + state

    _URL = "http://www.weather.gov/"
    #_URL = "
    http://forecast.weather.gov/MapClick.php?CityName=Novato&stateÊ&site=MTR&lat8.1032&lon=-122.63
    "

    br=mechanize.Browser()
    br.open( _URL )
    br.select_form( nr=1 ) #assuming form is 2nd form on page
    br['inputstring'] = query
    html = br.submit()

    _soup = B_S(html)

    # finding the correct table
    _step1 = _soup.findAll('table', limit=7)[6]
    col = _step1.findAll('td')
    _thumb = '<table><tr><td colspan=2>Forecast for ' + query + '<br>' +
    str(sys.argv) + '</td></tr><tr>' + str(col[0]) + str(col[1]) +
    '</tr></table>'
    _thumb = _thumb.replace( '11%','50%' )
    _thumb = _thumb.replace( '/images/', 'images/weather/' )

    #write to txt file TEST
    _temp = 'D:\\Inetpub\\AtoZ\\hometown\\include\\weatherFeed_TEMP.txt'
    temp = open( _temp, 'w' )
    temp.write( _thumb )
    temp.close()

    #print _thumb

    [/code]

    And my PHP:

    [code]

    <?PHP
    $city = 'Tampa';
    $state = 'FL';
    echo '<p><p>Python Weather Feed for ' . $city . ', ' . $state .
    '<p>';

    ob_start();
    $command = "include/weatherFeed.py -c " . $city . "-s " . $state;
    exec($command);
    $content=ob_get_contents();
    ob_end_clean();

    echo 'Content: ' . $content . '<br>';
    echo 'Result: ' . $result . '<br>';
    echo 'Data: ' . $data . '<br>';
    include('include\weatherFeed_TEMP.txt')
    ?>
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/tutor/attachments/20101022/f389b0d5/attachment-0001.html>
  • Bob gailer at Oct 22, 2010 at 7:13 pm

    On 10/22/2010 2:52 PM, Roy Hinkelman wrote:
    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.
    This is a pretty vague description of the problem. Please provide
    explicit details.

    This Python script works in IDLE, and I've got some testing code in there.

    One Known Unsolved Issue:
    I put Python in C:\Program Files\Python26\python.exe and have tried
    $command = "C:\Program Files\Python26\python.exe
    include/weatherFeed.py -c $city -s $state";
    to no avail.
    The full path to Python must be in quotes (due to the space in the
    path). I don't know enough Perl to tell you how to do this.

    In Python I would:
    command = '"C:\Program Files\Python26\python.exe" include/weatherFeed.py
    -c %s -s %s' % (city, state)

    [snip]


    --
    Bob Gailer
    919-636-4239
    Chapel Hill NC

    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/tutor/attachments/20101022/de385219/attachment.html>
  • Steven D'Aprano at Oct 23, 2010 at 12:57 am

    On Sat, 23 Oct 2010 05:52:06 am Roy Hinkelman wrote:
    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.
    "My script"? What are you talking about? You have at least two -- a PHP
    script and a Python script. If you're having problems with the PHP
    exec() command, that's probably a problem with the PHP script and you
    need to take it up with a PHP list.
    This Python script works in IDLE, and I've got some testing code in
    there.
    If it works fine, why are you showing it to us?

    One Known Unsolved Issue:
    I put Python in C:\Program Files\Python26\python.exe and have tried
    $command = "C:\Program Files\Python26\python.exe
    include/weatherFeed.py -c $city -s $state";
    to no avail.
    Unfortunately my crystal ball is broken, and I have a court order
    prohibiting me from reading people's minds, so I'm afraid I'm going to
    have to insist that you actually explain *what the problem is* instead
    of expecting us to guess.

    What is the unsolved issue?
    What do you expect the above line to do?
    What does it do instead?

    I added .py to Windows IIS Web Service Extensions and to the
    Application Configuration.
    How exciting! And what happened then?



    --
    Steven D'Aprano
  • Emile van Sebille at Oct 23, 2010 at 5:05 pm
    On 10/22/2010 11:28 AM Roy Hinkelman said...
    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.

    This Python script works in IDLE, and I've got some testing code in there.
    If your python code works and you're having trouble with the php
    invocation and return values, isn't this more of a php issue?

    Most of us here do our web serving with python...

    Emile
  • Roy Hinkelman at Oct 26, 2010 at 6:54 pm
    I am posting here as well as a PHP list since I am now getting an odd python
    error.

    Rance: Thanks for the note. I get the same error with system or exec or
    passthru

    Now, this is very strange.

    I made the command line string more explicit, and now it recognizes the .py
    script but returns a python error:

    Content:
    Data: ImportError: No module named mechanize
    Command: C:\WINDOWS\system32\cmd.exe C:\Program%20Files\Python26\python.exe
    /c D:\Inetpub\AtoZ\hometown\include\weatherFeed.py -c Tampa -s FL

    My python script will run correctly in IDE shell and from command line. I
    used easy_install to install mechanize. It seems to be recognizing my other
    modules (BeautifulSoup, re, urllib2, sys).

    So, it seems that the script is being activated by the exec command since I
    am now getting a python error. But, why would I get a python error when it
    will run from command line?

    Here is my PHP:
    [code]
    <?PHP
    error_reporting(E_ALL);

    $city = 'Tampa';
    $state = 'FL';
    echo '<p>OPTION 1<p>Python Weather Feed for ' . $city . ',
    ' . $state . '<p>';

    ob_start();
    $command = "C:\WINDOWS\system32\cmd.exe
    C:\Program%20Files\Python26\python.exe /c
    D:\Inetpub\AtoZ\hometown\include\weatherFeed.py -c " . $city . " -s " .
    $state;

    $data = exec($command . " 2>&1", $result);
    $content=ob_get_contents();
    ob_end_clean();

    echo 'Content: ' . $content . '<br>';
    echo 'Result: ' . $result . '<br>';
    echo 'Data: ' . $data . '<br>';
    echo 'Command: ' . $command . '<br>';
    include('include\weatherFeed_TEMP.txt')
    ?>
    [/code]

    and I've modified my python, making it a function
    [code]
    #!C:\Program Files\Python26\python.exe -u
    # Current weather feed
    # # Weather page sources: http://www.weather.gov/
    # Capture relevant data, strip unusable stuff out, fix URLs, display in our
    HTML page

    # import program modules
    from BeautifulSoup import BeautifulSoup as B_S
    import re, urllib2, sys, mechanize # 'standard' set

    ### Return small weather table
    def weatherSmall(c,s):
    cityState = c + ', ' + s
    query = 'Chicago, IL' #Test!!!
    _URL = "http://www.weather.gov/"

    br=mechanize.Browser()
    br.open( _URL )
    br.select_form( nr=1 ) #assuming form is 2nd form on page
    br['inputstring'] = query
    html = br.submit()

    _soup = B_S(html)

    # finding the correct table
    _step1 = _soup.findAll('table', limit=7)[6]
    col = _step1.findAll('td')
    # sys.argv is included below as a test.
    _thumb = '<table><tr><td colspan=2>Forecast for ' + query + '<br>' +
    str(sys.argv) + '</td></tr><tr>' + str(col[0]) + str(col[1]) +
    '</tr></table>'
    _thumb = _thumb.replace( '11%','50%' )
    _thumb = _thumb.replace( '/images/', 'images/weather/' )

    #write to txt file TEST
    _temp = 'D:\\Inetpub\\AtoZ\\hometown\\include\\weatherFeed_TEMP.txt'
    temp = open( _temp, 'w' )
    temp.write( _thumb )
    temp.close()

    return _thumb

    city = 'Establish'
    state = 'Variables'
    count = 0
    for ea in sys.argv:
    if ea == '-c':
    city = sys.argv[count+1]
    elif ea == '-s':
    state = sys.argv[count+1]
    count+=1
    _result = str(weatherSmall(city,state))
    #print _result
    [/code]

    Roy Hinkelman
    Technical Services
    Website Development & Management
    707-774-7411
    roy at worldtradepress.com
    ________________________________
    www.WorldTradePress.com (main website)
    www.StockMapAgency.com (3700+ Antique & Modern Maps)
    www.BestCountryReports.com (country reports for 175 countries)
    www.GiantMapArt.com (giant wall maps)
    www.WorldTradeRef.com (trade and logistics)
    www.GlobalRoadWarrior.com (175-country database)
    www.AtoZMapsOnline.com (worlds largest map database)
    www.AtoZtheUSA.com (extensive state facts database)

    -----Original Message-----
    From: Rance Hall [mailto:ranceh at gmail.com]
    Sent: Saturday, October 23, 2010 10:25 AM
    To: roy at worldtradepress.com
    Subject: Re: [Tutor] Problem Passing VARs to Python from PHP & capturing
    return string

    On Fri, Oct 22, 2010 at 1:28 PM, Roy Hinkelman
    wrote:
    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.

    This Python script works in IDLE, and I've got some testing code in there.

    One Known Unsolved Issue:
    I put Python in C:\Program Files\Python26\python.exe and have tried
    $command = "C:\Program Files\Python26\python.exe include/weatherFeed.py -c
    $city -s $state";
    to no avail.

    I added .py to Windows IIS Web Service Extensions and to the Application
    Configuration.

    Any help appreciated.
    <code snipped for brevity>

    Ok, so you wrote a Python script to create a text file, and you want
    PHP to include that text file in a web page.

    I'm assuming that your Python is working on its own.

    I also see you are running this from a windows server.

    According to the PHP site the exec function takes option arguments
    that you are not using:

    string exec ( string $command [, array &$output [, int &$return_var ]] )

    Might I suggest that you switch from exec to system()

    documented here: http://www.php.net/manual/en/function.system.php

    string system ( string $command [, int &$return_var ] )

    Since it doesn't appear that your Python script has any output except
    for the text file, it might be better to call it from system() because
    system() does not care about the output of the called program.

    May I also suggest that you actually track the return_var somewhere.
    You can check the status of the return_var to ensure that the system()
    call competed successfully or not before including the text file, on
    the off chance that it isn't there.

    Someone else has already suggested to you that this is a Python list
    and you should probably take this to the PHP list. I agree, but the
    teacher in me just couldn't leave the answer as "take it to another
    forum" without some guidance. Good luck.

    Rance
    No virus found in this incoming message.
    Checked by AVG - www.avg.com
    Version: 9.0.862 / Virus Database: 271.1.1/3218 - Release Date: 10/24/10
    23:34:00
  • Dave Angel at Oct 27, 2010 at 12:42 pm

    On 2:59 PM, Roy Hinkelman wrote:
    I am posting here as well as a PHP list since I am now getting an odd python
    error.

    Rance: Thanks for the note. I get the same error with system or exec or
    passthru

    Now, this is very strange.

    I made the command line string more explicit, and now it recognizes the .py
    script but returns a python error:

    Content:
    Data: ImportError: No module named mechanize
    Command: C:\WINDOWS\system32\cmd.exe C:\Program%20Files\Python26\python.exe
    /c D:\Inetpub\AtoZ\hometown\include\weatherFeed.py -c Tampa -s FL

    My python script will run correctly in IDE shell and from command line. I
    used easy_install to install mechanize. It seems to be recognizing my other
    modules (BeautifulSoup, re, urllib2, sys).

    So, it seems that the script is being activated by the exec command since I
    am now getting a python error. But, why would I get a python error when it
    will run from command line?

    Here is my PHP:
    [code]
    <?PHP
    error_reporting(E_ALL);

    $city = 'Tampa';
    $state = 'FL';
    echo '<p>OPTION 1<p>Python Weather Feed for ' . $city . ',
    ' . $state .'<p>';

    ob_start();
    $command = "C:\WINDOWS\system32\cmd.exe
    C:\Program%20Files\Python26\python.exe /c
    D:\Inetpub\AtoZ\hometown\include\weatherFeed.py -c " . $city . " -s " .
    $state;

    $data = exec($command . " 2>&1", $result);
    $content=ob_get_contents();
    ob_end_clean();

    echo 'Content: ' . $content . '<br>';
    echo 'Result: ' . $result . '<br>';
    echo 'Data: ' . $data . '<br>';
    echo 'Command: ' . $command . '<br>';
    include('include\weatherFeed_TEMP.txt')
    ?>
    [/code]

    and I've modified my python, making it a function
    [code]
    #!C:\Program Files\Python26\python.exe -u
    # Current weather feed
    # # Weather page sources: http://www.weather.gov/
    # Capture relevant data, strip unusable stuff out, fix URLs, display in our
    HTML page

    # import program modules
    from BeautifulSoup import BeautifulSoup as B_S
    import re, urllib2, sys, mechanize # 'standard' set

    ### Return small weather table
    def weatherSmall(c,s):
    cityState = c + ', ' + s
    query = 'Chicago, IL' #Test!!!
    _URL = "http://www.weather.gov/"

    br=mechanize.Browser()
    br.open( _URL )
    br.select_form( nr=1 ) #assuming form is 2nd form on page
    br['inputstring'] = query
    html = br.submit()

    _soup = B_S(html)

    # finding the correct table
    _step1 = _soup.findAll('table', limit=7)[6]
    col = _step1.findAll('td')
    # sys.argv is included below as a test.
    _thumb = '<table><tr><td colspan=2>Forecast for ' + query + '<br>' +
    str(sys.argv) + '</td></tr><tr>' + str(col[0]) + str(col[1]) +
    '</tr></table>'
    _thumb = _thumb.replace( '11%','50%' )
    _thumb = _thumb.replace( '/images/', 'images/weather/' )

    #write to txt file TEST
    _temp = 'D:\\Inetpub\\AtoZ\\hometown\\include\\weatherFeed_TEMP.txt'
    temp = open( _temp, 'w' )
    temp.write( _thumb )
    temp.close()

    return _thumb

    city = 'Establish'
    state = 'Variables'
    count = 0
    for ea in sys.argv:
    if ea == '-c':
    city = sys.argv[count+1]
    elif ea == '-s':
    state = sys.argv[count+1]
    count+=1
    _result = str(weatherSmall(city,state))
    #print _result
    [/code]

    Roy Hinkelman
    I don't know anything about PHP, so take the following for what it's worth.

    So where is mechanize.py ? The import error means that it can't be
    found. Yet if you run the program standalone it's finding it? My guess
    is that it depends on the current directory when you enter the script.

    First thing to do is to split the import line, so that the import
    mechanize follows the others on its own line. Then you can put some
    debugging lines in between them, perhaps saving off the os.curdir and
    sys.path values. I suspect the difference between running under php and
    from command line is in one of those.

    DaveA
  • Roy Hinkelman at Oct 26, 2010 at 7:55 pm
    I am posting here as well as a PHP list since I am now getting an odd python
    error.



    Rance: Thanks for the note. I get the same error with system or exec or
    passthru



    Now, this is very strange.



    I made the command line string more explicit, and now it recognizes the .py
    script but returns a python error:



    Content:

    Data: ImportError: No module named mechanize

    Command: C:\WINDOWS\system32\cmd.exe C:\Program%20Files\Python26\python.exe
    /c D:\Inetpub\AtoZ\hometown\include\weatherFeed.py -c Tampa -s FL



    My python script will run correctly in IDE shell and from command line. I
    used easy_install to install mechanize. It seems to be recognizing my other
    modules (BeautifulSoup, re, urllib2, sys).



    So, it seems that the script is being activated by the exec command since I
    am now getting a python error. But, why would I get a python error when it
    will run from command line?



    Here is my PHP:

    [code]

    <?PHP

    error_reporting(E_ALL);



    $city = 'Tampa';

    $state = 'FL';

    echo '<p>OPTION 1<p>Python Weather Feed for ' . $city . ', ' .
    $state . '<p>';



    ob_start();

    $command = "C:\WINDOWS\system32\cmd.exe
    C:\Program%20Files\Python26\python.exe
    /c D:\Inetpub\AtoZ\hometown\include\weatherFeed.py -c " . $city . " -s " .
    $state;



    $data = exec($command . " 2>&1", $result);

    $content=ob_get_contents();

    ob_end_clean();



    echo 'Content: ' . $content . '<br>';

    echo 'Result: ' . $result . '<br>';

    echo 'Data: ' . $data . '<br>';

    echo 'Command: ' . $command . '<br>';

    include('include\weatherFeed_TEMP.txt')

    ?>

    [/code]



    and I've modified my python, making it a function [code] #!C:\Program
    Files\Python26\python.exe -u # Current weather feed # # Weather page
    sources: http://www.weather.gov/ # Capture relevant data, strip unusable
    stuff out, fix URLs, display in our HTML page



    # import program modules

    from BeautifulSoup import BeautifulSoup as B_S import re, urllib2, sys,
    mechanize # 'standard' set



    ### Return small weather table

    def weatherSmall(c,s):

    cityState = c + ', ' + s

    query = 'Chicago, IL' #Test!!!

    _URL = "http://www.weather.gov/"



    br=mechanize.Browser()

    br.open( _URL )

    br.select_form( nr=1 ) #assuming form is 2nd form on page

    br['inputstring'] = query

    html = br.submit()



    _soup = B_S(html)



    # finding the correct table

    _step1 = _soup.findAll('table', limit=7)[6]

    col = _step1.findAll('td')

    # sys.argv is included below as a test.

    _thumb = '<table><tr><td colspan=2>Forecast for ' + query + '<br>' +
    str(sys.argv) + '</td></tr><tr>' + str(col[0]) + str(col[1]) +
    '</tr></table>'

    _thumb = _thumb.replace( '11%','50%' )

    _thumb = _thumb.replace( '/images/', 'images/weather/' )



    #write to txt file TEST

    _temp = 'D:\\Inetpub\\AtoZ\\hometown\\include\\weatherFeed_TEMP.txt'

    temp = open( _temp, 'w' )

    temp.write( _thumb )

    temp.close()



    return _thumb



    city = 'Establish'

    state = 'Variables'

    count = 0

    for ea in sys.argv:

    if ea == '-c':

    city = sys.argv[count+1]

    elif ea == '-s':

    state = sys.argv[count+1]

    count+=1

    _result = str(weatherSmall(city,state))

    #print _result

    [/code]



    Roy Hinkelman

    Technical Services

    Website Development & Management

    707-774-7411

    roy at worldtradepress.com

    ________________________________



    -----Original Message-----

    From: Rance Hall [mailto:ranceh at gmail.com]

    Sent: Saturday, October 23, 2010 10:25 AM

    To: roy at worldtradepress.com

    Subject: Re: [Tutor] Problem Passing VARs to Python from PHP & capturing
    return string


    On Fri, Oct 22, 2010 at 1:28 PM, Roy Hinkelman wrote:

    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. >
    This Python script works in IDLE, and I've got some testing code in there. >
    One Known Unsolved Issue:
    I put Python in C:\Program Files\Python26\python.exe and have tried
    $command = "C:\Program Files\Python26\python.exe
    include/weatherFeed.py -c $city -s $state"; to no avail. >
    I added .py to Windows IIS Web Service Extensions and to the
    Application Configuration. >
    Any help appreciated.
    >



    <code snipped for brevity>



    Ok, so you wrote a Python script to create a text file, and you want PHP to
    include that text file in a web page.



    I'm assuming that your Python is working on its own.



    I also see you are running this from a windows server.



    According to the PHP site the exec function takes option arguments that you
    are not using:



    string exec ( string $command [, array &$output [, int &$return_var ]] )



    Might I suggest that you switch from exec to system()



    documented here: http://www.php.net/manual/en/function.system.php



    string system ( string $command [, int &$return_var ] )



    Since it doesn't appear that your Python script has any output except for
    the text file, it might be better to call it from system() because

    system() does not care about the output of the called program.



    May I also suggest that you actually track the return_var somewhere.

    You can check the status of the return_var to ensure that the system() call
    competed successfully or not before including the text file, on the off
    chance that it isn't there.



    Someone else has already suggested to you that this is a Python list and you
    should probably take this to the PHP list. I agree, but the teacher in me
    just couldn't leave the answer as "take it to another forum" without some
    guidance. Good luck.



    Rance
    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://mail.python.org/pipermail/tutor/attachments/20101026/7ed8f77f/attachment-0001.html>
  • Emile van Sebille at Oct 26, 2010 at 8:15 pm
    On 10/26/2010 12:55 PM Roy Hinkelman said...
    I am posting here as well as a PHP list since I am now getting an odd python
    error.
    The traceback of the python error would help us diagnose the problem but
    it's not been included. Can you paste in the actual traceback?

    Emile

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouptutor @
categoriespython
postedOct 22, '10 at 6:28p
activeOct 27, '10 at 12:42p
posts9
users6
websitepython.org

People

Translate

site design / logo © 2022 Grokbase