Error help

2012-08-02 Thread danielashiloh
Hi all

This error has been bugging me for days. I know it's minor, but it's really 
getting in the way of my programming. I'm programming a data analysis programme 
for a psychology experiment which takes pickled data from the experiment and 
produces averages. For some reason python is insisting there is an indentation 
error on line 18. I have untabified and retabified and nothing seems to work. 
Here is the full code:


import cPickle, pickle

print 'WELLCOME TO THE LIBET CLOCK EXPERIMENT DATA ANALYSIST'
file=raw_input('\nPLEASE ENTER THE NAME OF THE FILE YOU WISH TO ANALYSE: ')
pickle_file=open(file, 'r')
data=cPickle.load(pickle_file)
file_name=file-'pck' + 'txt'
partifipant_info=data'Participant Info']
first_block_data=data['First block data']
second_block_data=data['Second block data']
first_block_estimates=first_block_data['Estimated times']
first_block_times=first_block_data['Actual times']
second_block_estimates=second_block_data['Estimated times']
second_block_times=second_block_data['Actual times']


def firstBlockDifferences():
print '\nCALCULATING AVERAGE DIFFERENCES FOR BLOCK 1' 
count=0
first_block_differences=[]
total=0
while count= 180:
differences-=360
elif differences <=-180:
differences+=360
total+=differences
differences=[differences]
first_block_differences+=differences
count+=1
average_diff_first_block=total/len(first_block_estimates)
text_file.write('\nAverage differences for block 1: ', 
average_diff_first_block)

def secondBlockDifferences():
print '\nCALCULATING AVERAGE DIFFERENCES FOR BLOCK 2'
count=0
second_block_differences=[]
total=0
while count= 180:
differences-=360
elif differences <=-180:
differences+=360
total+=differences
differences=[differences]
second_block_differences+=differences
count+=1
average_diff_second_block=total/len(second_block_estimates)
text_file.write('\nAverage differences for block 2: ', 
average_diff_second_block)


text_file=open(file_name, 'w')
text_file.write('\nParticipant info: ', participant_info)
firstBlockDifferences()
secondBlockDifferences()

I apologise for the lack of annotation and it may be a little inefficient, but 
I am really only after a solution to the error on line 18.

Thanks.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Error help

2012-08-02 Thread danielashiloh
On Thursday, 2 August 2012 12:18:59 UTC+1, Peter Otten  wrote:
> danielashi...@googlemail.com wrote:
> 
> 
> 
> > This error has been bugging me for days. I know it's minor, but it's
> 
> > really getting in the way of my programming. I'm programming a data
> 
> > analysis programme for a psychology experiment which takes pickled data
> 
> > from the experiment and produces averages. For some reason python is
> 
> > insisting there is an indentation error on line 18. 
> 
> 
> 
> I can't confirm that, I get an error in line 8
> 
> 
> 
> > partifipant_info=data'Participant Info']
> 
> 
> 
> where you forgot the opening '['. 
> 
> 
> 
> Please post your actual code and don't forget to include a cut-and-paste 
> 
> version of the traceback you get.

Thank you, everyone, for the replies. It does seem to stem from that missing 
bracket, indeed the error did start coming up when I first included that line. 
Do I feel silly! Incidentally, the error message I got was for an unexpected 
indent. All is resolved now.
-- 
http://mail.python.org/mailman/listinfo/python-list