Hi,
This is the existing code:

for c in chartNames:            
		chartUrl = baseChartUrl+c
		hd = extractChart(chartUrl)
		
		writeChart(hd,c)		

		for key in hd:			
			if key in chart:
				chart[key].append(c)
			else:
				chart[key] = [c]

when i wanted to insert a line before

chartUrl = baseChartUrl+c

by putting the cursor to the end of the

for c in chartNames:

and pressing an enter I get compile error.

what's happening here?

1. Can you please make the indentation level to 4 spaces.

2. Please use 'code=python' surrounded by square '[ ]' bracets so that it will be correctly cololur coded and end with '\code' enclosed in the same square brackets. Click on the link below for mode details on code tags
http://www.daniweb.com/forums/misc-explaincode.html?TB_iframe=true&height=400&width=680

OR you can click the link on the right side in the box below called '
Help with Code Tags'

This is what your code should look like:

for c in chartNames:
    chartUrl = baseChartUrl+c
    hd = extractChart(chartUrl)

    writeChart(hd,c)

    for key in hd:
        if key in chart:
            chart[key].append(c)
        else:
            chart[key] = [c]

3. Please provide hard coded values and to the list / tuple / dictionary & variables and function so that it is executable and gives an output or atleast a traceback

by putting the cursor to the end of the
for c in chartNames:
and pressing an enter I get compile error.

"I get a compile error" is too vague for anyone to figure out. It is probably that the blank line is not indented at the same level as the other lines and your editor does not like that (which is overly picky, but at the discretion of whoever wrote the editor), but as I said it is impossible to decipher without the line number of the error and what it is. Use try/except, especially when testing.

try:
    for c in chartNames:
        chartUrl = baseChartUrl+c
        hd = extractChart(chartUrl)
 
        writeChart(hd,c)
 
        for key in hd:
            if key in chart:
                chart[key].append(c)
            else:
                chart[key] = [c]
except:
    import traceback
    traceback.print_exc()
    raise
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.