Path: csiph.com!usenet.pasdenom.info!news.albasani.net!news.mixmin.net!hq-usenetpeers.eweka.nl!81.171.88.15.MISMATCH!eweka.nl!lightspeed.eweka.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'syntax': 0.03; 'elif': 0.04; 'subject:Error': 0.07; 'subject:help': 0.07; 'python': 0.09; "'w')": 0.09; 'skip:d 70': 0.09; 'spelling': 0.09; 'useless': 0.09; 'cc:addr:python-list': 0.10; 'def': 0.10; 'skip:f 30': 0.15; "'r')": 0.16; 'matters,': 0.16; 'minor,': 0.16; 'skip:d 80': 0.16; 'syntaxerror:': 0.16; 'later': 0.16; 'wrote:': 0.17; 'appears': 0.18; 'code.': 0.20; 'skip:p 30': 0.20; 'import': 0.21; 'thanks.': 0.21; 'error.': 0.21; 'supposed': 0.21; 'clock': 0.22; 'finally,': 0.22; 'produces': 0.22; 'cc:2**0': 0.23; 'programming': 0.23; 'work.': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'indentation': 0.29; 'pickle': 0.29; 'reduced': 0.29; "i'm": 0.29; "skip:' 10": 0.30; 'error': 0.30; 'code': 0.31; 'file': 0.32; 'could': 0.32; 'print': 0.32; 'getting': 0.33; 'skip:s 30': 0.33; 'stands': 0.33; 'code:': 0.33; 'skip:d 20': 0.34; 'version': 0.34; 'minimum': 0.34; 'programming.': 0.35; 'skip:f 40': 0.35; 'there': 0.35; 'really': 0.36; 'but': 0.36; "didn't": 0.36; 'skip:p 20': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'nothing': 0.38; 'shows': 0.38; 'takes': 0.39; 'received:192': 0.39; 'little': 0.39; 'received:192.168': 0.40; 'your': 0.60; 'chance': 0.61; 'strange': 0.62; 'here': 0.65; 'differences': 0.65; 'study': 0.66; 'header:Reply-To:1': 0.68; 'programme': 0.69; 'analysis': 0.70; 'wish': 0.70; 'lack': 0.71; 'received:74.208': 0.71; 'reply-to:no real name:2**0': 0.72; 'experiment': 0.84; 'participant,': 0.84; 'pickled': 0.84; 'psychology': 0.84; 'retype': 0.91; 'average': 0.93 Date: Thu, 02 Aug 2012 07:27:19 -0400 From: Dave Angel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:14.0) Gecko/20120714 Thunderbird/14.0 MIME-Version: 1.0 To: danielashiloh@googlemail.com Subject: Re: Error help References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:ZM7TtLt8DRTitVSkE2TDEgmUw0KLWqugfwKh21IpdkZ fmy66x8GSQgU3vRf9CoiNgOxt7N4qC2KMvjUE1eCtLzzZKtci1 0RfGV2eYAlyIwVeVCCnIePXN2Xe4jncgioNvLYtY/YUdA2Q5Tg d9kcKPr75TcpGlIJGnWAmpWJWKZVzbeXygROk1J/fYzy75VCv1 SO22R8ZLMdx1AwDxEgRbliInUGQJZsfWzzmWA7wtiuilIEeLOY ScXgKturiV0GQGOi2MhALldQIUxWEvZb6CwRCQVCgL923Dxin1 kZtJ62ZoGEb/a0q/1QmEDLxVIuuxdBDqxPvNnGvfIRG18JzxQ= = Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: d@davea.name List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 95 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1343906863 news.xs4all.nl 6924 [2001:888:2000:d::a6]:48250 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:26405 On 08/02/2012 06:58 AM, danielashiloh@googlemail.com wrote: > 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 differences=float(first_block_estimates[count])-float(first_block_times[count]) > if differences >= 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 differences=float(second_block_estimates[count])-float(second_block_times[count]) > if differences >= 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. You didn't include the error message, so how are we supposed to know which line is #18 ? if I take your message literally, it's a blank line. Even better, you could have reduced the code down to a minimum which still shows the error. As your code stands now, I get an error on line 10: File "daniel.py", line 10 partifipant_info=data'Participant Info'] ^ SyntaxError: invalid syntax It appears you're missing a left bracket. That line also has a strange spelling for participant, so you'd get an error later when you tried to use participant_info. Did you by any chance retype your program into the message? If you don't use copy/paste, it's useless for us to study your code. Finally, in case it matters, just what version of python did you use, and on what OS? -- DaveA