[Tutor] A Stuborn Tab Problem in IDLE

Wayne Watson sierra_mtnview at sbcglobal.net
Mon Feb 15 03:37:35 CET 2010


I got to the dos command line facility and got to the file. I executed 
the program, and it failed with a syntax error. I can't copy it out of 
the window to paste here, but here's the code surrounding the problem: 
(arrow ==> points at the problem.
The console code shows [ missing. I SEE the syntax error. It's two lines 
above the line with the arrow. The code now works. Thanks very much. 
Console wins again!

  (I suspect you are not into matplotlib, but the plot requires a list 
for x and y in plot(x,y). xy[0,0] turns out to be a float64, which the 
syntax rejects. I put [] around it, and it works. Is there a better way?

         ax1.plot([xy[0,0]],[xy[0,1]],'gs')
         if npts == 90: # exactly 90 frames
             ax1.plot([xy[npts-1,0]], xy[npts-1,1]],'rs') # mark it is a 
last frame
         else:
             ax1.plot([xy[npts-1,0]], ==>[xy[npts-1,1]],'ys') # mark 
90th frame in path
         last_pt = len(xy[:,0])
         ax1.plot([xy[npts-1,0]],[xy[npts-1,1]],'rs')

On 2/14/2010 6:18 PM, Wayne Watson wrote:
> Well, command line was easy to get to. It's on the menu for python, 
> but it gives me >>>.  How do I get to the folder with the py file?  
> Can I switch to a c:\  type operation?
>
> Back to exploring.
>
> On 2/14/2010 5:05 PM, Alan Gauld wrote:
>>
>> "Wayne Watson" <sierra_mtnview at sbcglobal.net> wrote
>>> When I use F5 to execute a py program in IDLE, Win7, I get a tab 
>>> error on an indented else. 
>>
>> What happens if you execute from a command line? Do you get the same 
>> error?
>> If so look at the lines before.
>> If not try closing and restarting IDLE
>>
>> HTH,
>>
>> Alan G
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>

-- 
"Crime is way down. War is declining. And that's far from the good 
news." -- Steven Pinker (and other sources) Why is this true, but yet 
the media says otherwise? The media knows very well how to manipulate us 
(see limbic, emotion, $$). -- WTW


More information about the Tutor mailing list