Why this compile error?

Jimbo nilly16 at yahoo.com
Fri Mar 19 05:37:35 EDT 2010


Hello

Can you help me figure out why I am getting this compile error with my
program. The error occurs right at the bottom of my code & I have
commented where it occurs.

The error is:
[QUOTE]Expected an indented block[/QUOTE]

[CODE]"""
 *Stock Data Builder*
   Algorithm:
      - Search website for stock
      - Get website HTML source code
      - Search code for target stock data(price,dividends)
      - Add data to text file
"""

import sys

# Functions
def getSource(URL, sourceBuffer):
    """ Retrieve HTML source code from websitr URL &
        save in sourceBuffer                       """

    return sourceBuffer

def getData(targetData, dataBuffer):
    """ Searches the string dataBuffer for the occurence of target
        data & returns that whole line                            """

def writeToFile(textFile, dataBuffer):
    """ Writes data in string dataBuffer to text file """

    # CHANGE this to try except to catch errors
    fileT = open(textFile,'a')
    fileT.write(dataBuffer)
    return True; # function succeeded

def writeToFile(textFile, dataList):
    """ Writes data in List dataList to text file """

    # CHANGE this to try except to catch errors
    fileT = open(textFile,'a')

    for element in dataList:
        fileT.write(element)
    return True; # function succeeded



# Main program loop
def main():
    programEnd = False;

    while (programEnd == False):
        #ERROR HERE?? - Error="Expected an indented block"
main()[/CODE]



More information about the Python-list mailing list