[Tutor] A Stuborn Tab Problem in IDLE

Dave Angel davea at ieee.org
Mon Feb 15 04:01:19 CET 2010


Wayne Watson wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">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
>>>
Once you've discovered the DOS box, you should also discover QuickEdit 
mode.  In the DOS box, right click on the title bar, and choose 
"Properties".  First tab is Options.  Enable Quick-Edit mode, and press 
OK.  Now, you can drag a rectangle on the DOS box, and use right click 
to paste it to the clipboard. Practice a bit and you'll find it easy.  
An essential tool.

DaveA



More information about the Tutor mailing list