m &UIc@sdkZdkZdkZdkZdkZdkZdkZdkZdkZdk Z dk Z dk Z dk Z dk lZy dkTWn-ej o!eidIJeidnXdkZdklZlZdklZdklZdklZd klZd klZdkZdkZdkZdkZei ei!d Z"d Z#yd k$l%Z%Wnej o dZ%nXeia&y dk'Z'Wnej on&XdZ(e(e'_)dZ*e*e'_+e,e i-dZ.e.e _-defdYZ/defdYZ0defdYZ1defdYZ2dei3fdYZ4defdYZ5defdYZ6d fd!YZ7d"Z8d#Z9e:d$joei;d$ei;d>> N( tsR R t linecachetgetlinetstriptlineRt__name__R(RRR R RR((R tidle_formatwarningAscCsiti}h}x?|iD]1}|d |ddjo|||| entries Rather than repeating the linecache code, patch it to save the entries, call the original linecache.checkcache() (which destroys them), and then restore the saved entries. orig_checkcache is bound at definition time to the original method, allowing it to be patched. iis<>N(RtcachetsavetkeysR torig_checkcachetupdate(R RRR((R textended_linecache_checkcacheLs   tPyShellEditorWindowcBsztZdZdZddgZdZedZedZd Z d Z d Z d Z d Z dZRS(s6Regular text edit window in IDLE, supports breakpointscGsg|_ti|||iid|i|iid|i|iid|i i t i i tid|_|iio|in|ii|d}|ii|dS(Ns<>s<>s<>sbreakpoints.lstcCs|i|dS(N(tselftrestore_file_breakstold_hook(RR((R tfilename_changed_hookrs (Rt breakpointst EditorWindowt__init__targsttexttbindtset_breakpoint_heretclear_breakpoint_heretflistt open_shelltostpathtjointidleConft GetUserCfgDirtbreakpointPathtioR Rtfilename_change_hookRtset_filename_change_hook(RR#R((R R"gs   sSet Breakpoints<>sClear Breakpoints<>cCs|i}|ii}|idd|d|dy|ii|}Wn#t j o|ii |nXy&|i i i i}|i||WnnXdS(NtBREAKs%d.0i(RR$R0R ttag_addR R tindextit ValueErrortappendR(tpyshelltinterptdebuggertdebugR&(RR R6R$R R<((R tset_breakpoint{s  cCsZ|i}|ii}|p|idSntt|id}|i |dS(Ntinsert( RR$R0R tbelltinttfloatR5R R=(RteventR$R R ((R R&s   cCs|i}|ii}|p|idSntt|id}y|i i |WnnX|i dddy&|i i ii}|i||WnnXdS(NR>R3sinsert linestartsinsert lineend +1char(RR$R0R R?R@RAR5R R tremovet tag_removeR(R9R:R;R<R'(RRBR$R R R<((R R's"    cCs|io{|i}|ii}|p|idSng|_|iddty#|ii i i }|i |WqqXndS(NR3s1.0(RR R$R0R R?RDtENDR(R9R:R;R<tclear_file_breaks(RR<R$R ((R RFs     cCs|i}|ii}yt|idi}Wnt j o g}nXt|id}x3|D]+}|i |dp|i |qfqfW|i|i}|o#|i |dt|dn|idS(s#Save breakpoints when file is savedtrtwt=s N(RR tbreaksR0R topenR/t readlinestlinesR tnew_fileRt startswithRtupdate_breakpointststrtclose(RRNRMR RRJ((R tstore_file_breakss"     #cCs|ii|ii}|djodSntii|i o}t |i di }xb|D]V}|i|do<t|t|d}x|D]}|i|qWqcqcWndS(NRGRIi(RR$RR0R tNoneR*R+tisfileR/RKRLRMRROtevaltlentbreakpoint_linenumberstbreakpoint_linenumberR=(RRYRMR RRX((R Rs   cCs4|i}|id}|i|}||_dS(s3Retrieves all the breakpoints in the current windowR3N(RR$t tag_rangestrangestranges_to_linenumberstlinenumber_listR (RR[R$R]((R RPs  cCsg}x|tdt|dD]b}tt||}tt||d}x)||jo|i ||d7}qXWqW|S(Niii( RMtrangeRWR[R5R@RAR tendR8(RR[R5R_RMR ((R R\s  cCs|iti|dS(s7Extend base method - clear breaks when module is closedN(RRFR!t_close(R((R R`s (sSet Breakpoints<>(sClear Breakpoints<>(Rt __module__t__doc__R"t rmenu_specsR=RTR&R'RFRSRRPR\R`(((R Rds       '  tPyShellFileListcBs&tZdZeZeZedZRS(s8Extend base class: IDLE supports a shell and breakpointscCsZ|io|iiin6t||_|io|iipdSqSn|iS(N(RR9ttoptwakeuptPyShelltbeginRT(RRB((R R)s   (RRaRbRR!RTR9R)(((R Rds tModifiedColorDelegatorcBs)tZdZdZdZdZRS(s8Extend base class: colorizer for the shell window itselfcCsti||idS(N(tColorDelegatorR"Rt LoadTagDefs(R((R R"s cCs7|iddd|idddti|dS(NtTODOs1.0tiomarktSYNC(RRDR4Rjtrecolorize_main(R((R Ro!scCsti|tiddd}|iihdhdd<dd<<dti |d<dti |d<d ti |d <dti |d <dS( NtmaintThemetnametstdint backgroundt foregroundtstdouttstderrtconsoletnormal( RjRkRR-t GetOptiontthemettagdefsRRTt GetHighlight(RR{((R Rk&s (RRaRbR"RoRk(((R Ris   tModifiedUndoDelegatorcBs&tZdZedZedZRS(s;Extend base class: forbid insert/delete before the I/O markcCsby2|ii|ddo|iidSnWntj onXti||||dS(Nttcharsttags(RR5RR((R R>4s  cCs_y2|ii|ddo|iidSnWntj onXti|||dS(NRRm( RRRtindex1R?RRtdeletetindex2(RRR((R R=s  (RRaRbRTR>R(((R R~1s  t MyRPCClientcBstZdZRS(NcCs tdS(s0Override the base class - just re-raise EOFErrorN(tEOFError(R((R t handle_EOFIs(RRaR(((R RGstModifiedInterpretercBs@tZdZdZdZdZdZdZdZ dZ dZ dZ d Z d Zd ZdZd ZdZd ZdZdZdZdZdZddZdZdZdZddZdZdZdZ dZ!dZ"dZ#dZ$dZ%d Z&RS(!NcCsQ||_tidi}ti|d|d|_ t |_ |i |_ dS(Nt__main__tlocals(t tkconsoleRtsystmodulest__dict__RtInteractiveInterpreterR"RTtsave_warnings_filterstFalset restartingtbuild_subprocess_arglisttsubprocess_arglist(RRR((R R"Ps    i"cCs+|i}tititi||_dS(N( RRR#R*tspawnvtP_NOWAITRt executabletrpcpid(RR#((R tspawn_subprocess\s cCsg}tiD]}|d|q~}tiddddtdd}t djod |f}nd |f}ti d d jo!d ti jodti }n ti }|g|d|t|igS(Ns-WRptGeneralsdelete-exitfunctdefaultttypetboolsidlelib.PyShells&__import__('idlelib.run').run.main(%r)s__import__('run').main(%r)itwint s"%s"s-c(t_[1]Rt warnoptionsRRHR-RzRt del_exitfRtcommandtplatformRtdecorated_execRQRtport(RRRRRHRR((R R`s(  $ cCsi|it|if}x^tdD]B}ti|yt ||_ PWq&t i j o }q&Xq&W|idS|i iidy|i iWn&t ij o}|idSnX|i id|i|i id|ii|i id|ii|i id|ii|i idt|i id||i|i|i S( Nii RsRvRwR(RR:(RRt LOCALHOSTRtaddrR^R6ttimetsleepRtrpcclttsocketterrorterrtdisplay_port_binding_errorRTtlistening_sockt settimeouttacceptttimeouttdisplay_no_subprocess_errortregisterRRvRwR(Rt transfer_pathtpoll_subprocess(RRRR6((R tstart_subprocessrs6         cCs|io |iSnt|_|i}|o"yti|iWqSqSXn|ii|i |i }|i }t|_ |iy|iiWn&tij o}|idSnX|i|iidd|o|id|int|iddd}|i|d||iidd|iidd |i|o ti |i}|i"nt|_|iS( NRmsend-1cs iiRIs RESTART trestarttleft(#RRRtTruet getdebuggerR<tRemoteDebuggertclose_subprocess_debuggerRRtunix_terminateRRxt executingt was_executingRRRRRRRRTRR$RRt showpromptR@twidththalfbartmark_sett mark_gravitytrestart_subprocess_debuggertguitload_breakpoints(RRxRRR<RR((R trestart_subprocesssF                cCs|iiddfhdS(Ntexectinterrupt_the_server(RRt remotecall(R((R t__request_interruptscCstid|iidS(Nttarget(t threadingtThreadRt'_ModifiedInterpreter__request_interrupttstart(R((R tinterrupt_subprocessscCsJy|iiWntj onX|it|i_d|_dS(N( RRRRtAttributeErrorRRRRRT(R((R tkill_subprocesss  cCszttdofyti|itWntj o dSqvXyti|idWqvtj o dSqvXndS(s;UNIX: make sure subprocess is terminated and collect statustkillNi(thasattrR*RRRtSIGTERMtOSErrortwaitpid(R((R Rs cCs|idtifdS(Nsif 1: import sys as _sys _sys.path = %r del _sys _msg = 'Use File/Exit or your end-of-file key to quit IDLE' __builtins__.quit = __builtins__.exit = _msg del _msg (Rt runcommandRR+(R((R RscCs|i}|djodSny|i|idd}WnAttt fj o,|i i odSnd}|i nX|o|i i d|_|\}}|i i}|djo%|dj o|t|IJqQnm|djo%|i ido|iqQn;|djo-d}ti|I|IJ||I|IJn|i in|i i p#|i ii|i i|indS(Ntwaitf0.050000000000000003tOKt EXCEPTIONs<>tERRORs/PyShell.ModifiedInterpreter: Subprocess ERROR: (RRtcltRTt pollresponset active_seqtresponseRR tKeyboardInterruptRtclosingRt resetoutputthowtwhatRxtreprtgetvartremote_stack_viewerterrmsgRt __stderr__t endexecutingR$taftert pollintervalR(RRRxRRRR((R Rs:            cCs ||_dS(N(R;R(RR;((R t setdebugger scCs|iS(N(RR;(R((R RscCs|iiid|idS(sInitiate the remote stack viewer from a separate thread. This method is called from the subprocess, and by returning from this method we allow the subprocess to unblock. After a bit the shell requests the subprocess to open the remote stack viewer which returns a static object looking at the last exceptiopn. It is queried through the RPC mechanism. i,N(RRR$RR(R((R topen_remote_stack_viewers c Csdk}|iidddh}|djo|iiidSn|i |i|}dk l }l }t|ii} tiddd}ti|dd }|| d |d d } | iid ddd|| id|}|idS(NRt stackviewerR((sScrolledCanvassTreeNodeRpRqRrRyRttbgthighlightthicknessitexpanditfilltboth(sflist(tRemoteObjectBrowserRRt remotequeuetoidRTRtrootR?tStubObjectTreeItemtitemt TreeWidgettScrolledCanvastTreeNodetToplevelReR-RzR{R}RttsctframetpacktcanvastnodeR( RR RRRtRRR{RRRe((R R s  icCs#|i|}|i||dS(s1Like runsource() but assumes complete exec sourceN(Rt stuffsourcetsourceR texecfile(RRR ((R t execsource3scCs|djot|di}nyt||d}Wncttfj oQ|i i |i i }|dIJ|dIJti|||i inX|i|dS(sExecute an existing fileRGRs *** Error in script or command! s"Traceback (most recent call last):N(RRTRKR treadtcompiletcodet OverflowErrort SyntaxErrorRRRRwttkerrRtshowsyntaxerrorRtruncode(RR RRR((R R8s     cCs|i|}d|_ti|_tidddt t |t i oWdk }y|i|i}Wqtj o%|ii|iddSqXnzti|||SWd|idj o|iti(d|_nXdS(sBExtend base class method: Stuff the source in the line cache firstitactionRRNsUnsupported characters in input(RR RR tmoreRtfiltersRtfilterwarningst SyntaxWarningt isinstancettypest UnicodeTypet IOBindingtencodetencodingt UnicodeErrorRRRRt runsourceRT(RRR R!((R R%Hs&       cCsSd|i}|id|_|id}t|dd||fti|<|S(s"Stuff source in the filename caches is iN( RtgidR RtsplitRMRWRR(RRRMR ((R R ]s  #cCs|id|fdS(s>Prepend sys.path with file's directory if not already includeds(if 1: _filename = %r import sys as _sys from os.path import dirname as _dirname _dir = _dirname(_filename) if not _dir in _sys.path: _sys.path.insert(0, _dir) del _filename, _sys, _dirname, _dir N(RRR (RR ((R tprepend_syspathesc Cs|ii}|i}|o|\}}}} |djod|d}nd|d|df}|i d||i ||i |}|o(|tjo|i d|d|n|ii|idt|n|iiti|||iidS(sExtend base class method: Add Colorizing Color the offending position instead of printing it and pointing at it with a caret. isiomark + %d charss&iomark linestart + %d lines + %d charsRs wordstartsSyntaxError: %s N(RRR$t unpackerrortstufftmsgR toffsetRtposR4tseetgettchart IDENTCHARSRRRQRRR R( RR R$R-R0R*R R,R+R((R Rqs$      c Csti\}}} |tj}|oAy-|\}\}}}}|p d}nWqid}qiXn|o||||fSndSdS(Ni( Rtexc_infoRtvaluettbRtokR+tdummy_filenameR R,RRT( RR5RRR3R R,R+R6R4((R R)s cCsL|ii|iti||iido|iindS(s1Extend base class method to reset output properlys<>N(RRRtchecklinecacheRt showtracebackRtopen_stack_viewer(R((R R8s    cCsHti}x8|iD]*}|d |ddjo ||=qqWdS(Niis<>(RRtcRtkey(RR:R;((R R7s   cBsX|iio|idSn|io |iidd|fhn ||iUdS(s*Run the code without invoking the debuggeriRRiN(RRRtdisplay_executing_dialogRRRR(RR((R Rs     cBsR|iio|iin|i|idj o|iei (d|_n|i }z|ii yj| o5|i dj o%|i i dd|fh|_n*|o|i||in ||iUWnYej o=eiddddd|iioq1|in|inXWdep|iinXdS( sOverride base class methodRRsExit?sDo you want to exit altogether?RtyestmasterN(RRRR:RR7RRTRRR;tbeginexecutingRt asyncqueueRRtrunRt SystemExitt tkMessageBoxtaskyesnoR$R8tuse_subprocessR(RRR;((R Rs:       cCs|iii|dS(sOverride base class methodN(RRRwRR(RR((R RscCs tiddd|iidS(NsPort Binding ErrorsgIDLE can't bind TCP/IP port 8833, which is necessary to communicate with its Python execution server. Either no networking is installed on this computer or another process (another IDLE?) is using the port. Run IDLE with the -n command line switch to start without a subprocess and refer to Help/IDLE Help 'Running without a subprocess' for further details.R>(RCt showerrorRRR$(R((R Rs cCs tiddd|iidS(NsSubprocess Startup ErrorsIDLE's subprocess didn't make connection. Either IDLE can't start a subprocess or personal firewall software is blocking the connection.R>(RCRFRRR$(R((R Rs cCs tiddd|iidS(NsAlready executingsYThe Python Shell window is already executing a command; please wait until it is finished.R>(RCRFRRR$(R((R R<s ('RRaR"RRTRRRRRRRRRRRRRR;RRRRR&RRR%R R(RR)R8R7RRRRRR<(((R RNsH    ! ,     #            "  RgcBstZdZeZeZd1d2d3d4d5d6gZdkl Z ddZ dZ e Ze Ze Ze Ze ZdZdZddZdZddZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%dd$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,dd+Z-dd,Z.dd-Z/d.Z0d/Z1fd0Z2RS(7Ns Python ShellRt_Fileteditt_EditR<t_Debugtoptionst_Optionstwindowst_Windowsthelpt_Help(sHistorycCsvto6|i}|dddjo|iddq=nt||_|djo-t }t ||i t |}nti||dddk}d|_|_|idddd d d|i}|id d |id |i|id|i|id|i|id|i|id|i|id|i|id|i|id|ito*|id|i|id|i nt!i"|_#t!i$|_%t!i&|_'dk(}t)|d|i*|_"t)|d|i*|_$t)|d|i*|_+tp%|i"t!_"|i$t!_$|t!_&n|i,|i|_-d|_.dS(Niitshellt_ShellsTo exit, type Ctrl-D.tusetabsit indentwidthitcontext_use_ps1twrapR0s<>s<>s<>s<>s<>s<>s<>s<>s<>s<>RvRwRxi2(sshellRR(/RERt menu_specstmsR>RR:R(RTtTkRt fixwordbreakstwithdrawRdt OutputWindowR"t __builtin__tquittexittconfigR$t configureR%tenter_callbacktlinefeed_callbacktcancel_callbackt home_callbackt eof_callbackR9ttoggle_debuggerttoggle_jit_stack_viewertview_restart_markt restart_shellRRvt save_stdoutRwt save_stderrRst save_stdinR!t PseudoFileR#RxtHistorythistoryR(RR(R$R]RXRR!((R R" sP              cCstidtS(Nt shell_only(R-t GetExtensionsR(R((R tget_standard_extension_names>scCs |adS(N(tstreamR(RRt((R tset_warning_streamGscCstS(N(R(R((R tget_warning_streamKscCsg|io+tiddd|i|idSn/|ii}|o|i n |i dS(NsDon't debug nows*You can only toggle the debugger when idleR>tbreak( RRRCRFR$tset_debugger_indicatorR:Rtdbtclose_debuggert open_debugger(RRBRy((R RgNs    cCs%|ii}|id| dS(Ns<>(RR:RRytsetvar(RRy((R Rx\scCsdS(N((RRB((R Rh`scCs|ii}|oo|iid|i|iioti |iin|i |i i ddt _|in|idS(Ns [DEBUG OFF] s>>> (RR:RRyRRTRRRRtclose_remote_debuggerRRxRRtps1RRx(RRy((R Rzcs    cCss|iioti|ii|}nti|}|ii||idt _ |i |i dS(Ns[DEBUG ON] >>> ( RR:RRtstart_remote_debuggertdbg_guitDebuggerRRRR~RRx(RR((R R{ps     cCs|id|_dS(sHelper for ModifiedInterpreteriN(RRR(R((R R?|s cCs d|_d|_|idS(sHelper for ModifiedInterpreteriN(RRtcanceledR(R((R Rs  cCs|io:tiddddd|i}|tjodSqDn|io|ii nt |_ t |_ |ii d|i|idS( sExtend EditorWindow.close()sKill?s6The program is still running! Do you want to kill it?RR5tparenttcanceliN(RRRCt askokcancelR$RRtreadingReR^RRRRRtclose2(RR((R RRs       cCs ti|S(N(R!RRR(R((R RscCs~|ito|iin|it_|it_ |i t_ d|_d|_ d|i_d|_ti|dS(sEExtend EditorWindow._close(), shut down debugger and execution serverN(RRzRER:RRkRRvRlRwRmRsRTRxR(R9RpR!R`(R((R R`s        cCstS(s8Override EditorWindow method: never remove the colorizerN(R(RR ((R tispythonsourcescCs|iS(N(Rt shell_title(R((R t short_titless@Type "copyright", "credits" or "license()" for more information.s **************************************************************** Personal firewall software may warn about the connection IDLE makes to its subprocess using this computer's internal loopback interface. This connection is not visible on any external interface and no data is sent to or received from the Internet. **************************************************************** cCs|ito2d}|ii}|p|itSqInd}|i dt i t i |i |iti|f|idk}d|_tS(Nts==== No Subprocess ====s&Python %s on %s %s %s IDLE %s %s (RRREtnosubR:RtclientRRRRRtversionRt COPYRIGHTtfirewallmessagetidlevert IDLE_VERSIONRtTkinterRTt _default_rootR(RRRR((R Rhs   2   cCs|i}zd|_|iiWd||_X|iidd}t|djo d}nt |t o9dk }y|i |i }Wqtj oqXn|i|iod|_tp tqn|iod|_d}n|S(NiRmsend-1cis R(RRRRetmainloopR$R/RRWRtunicodeR!R"R#R$RRRERt endoffile(RRRR!((R treadlines0            cCstS(N(R(R((R tisattyscCsy%|iidddodSnWnnX|ip|ip,|i|iid|idSnd|_ d|_ |io?|ii o2|ii o|ii q|iin|io|iindS(Ns sel.firsts!=ssel.lastsKeyboardInterrupt Rwii(RR$RRRRR:RRRRRRRRReR^(RRB((R Rds&      cCs|io|i odSn|iidddo|iidddpdSn|ip|i|in d|_d|_|i i dS(NRms==R>send-1ciiRw( RRRR$RRRRRRReR^(RRB((R Rfs2     cCs|idjo|idjodSn|iidddoZ|iidddoA|iidd|iiddd |iidd SndS( NitHomeRms<=R>sinsert linestarttsels1.0R_Rw( RBtstatetkeysymRR$RRRDR.(RRB((R Res 2cCsB|io'|iidd|iidn|i|dS(NR>s Rw(RRR$R>R.tnewline_and_indent_eventRB(RRB((R Rcs   cCs|io|i odSnyR|iidd}|o2|iidddo|i|dSqnnWnnX|iidddo.|iid d}|oI|iidd|d o,|i|ii|d |d dSn|ii d d}|oI|iid d |d o,|i|ii|d |d dSn|iidd }t iidd}|i|o|t|}n|i|dSn|iidddo|iiddn|iidd}|o%|i o|iiddn|iidddo|i|dSn|iidd|io'|iidd|iidn|i||iid dd|ii|io|iin |idS(Ns sel.firstssel.lasts<=RmRwR>Rsiomark linestartRsiisinsert lineends>=sinsert linestarts isend-1csend-1c linestart( RRRR$R/RRtrecallt tag_prevrangetprevt tag_nextrangetnextRRR~R'tlast_line_of_promptRORWRRRRRRBR>R.R4tupdate_idletasksReR^trunit(RRBRRRRRR((R Rb%sX $$$$       cCs"|io|ii|ndS(N(RRpRR(RR((R Rcs cCs|iidd}t|}x1|djo#||ddjo|d}q$W|djo#||ddjo|d}nx1|djo#||ddjo|d}qW|| }|ii|}dS(NRmsend-1ciis s ( RR$R/RRWR6R:R%R(RR6RR((R Rgs """ cCsv|iio|iiSny tiWn$tiddd|idSnXdk l }||i |i }dS(NsNo stack traces@There is no stack trace yet. (sys.last_traceback is not defined)R>(s StackBrowser(RR:RRRtlast_tracebackRCRFR$t StackViewert StackBrowserRR(tsv(RRBRR((R R9us     cCs$|iid|iiddS(NRmR(RR$R.(RRB((R RiscCs|iidS(N(RR:R(RRB((R RjscCsk|iytti}Wn d}nX|ii||ii dd|i |i i dS(NRR>send-1c( RRRQRR~RRxRR$Rtset_line_and_columnR0t reset_undo(RR((R Rs   cCs|iidd}|io|ii|n|iiddjo|iiddn|iidd|idt i _ dS(NRmsend-1csend-2cs i( RR$R/RRpt history_storeR>RRRRvt softspace(RR((R Rs  cCsvy@|iiddti|||d|iiddWnnX|iod|_tp t qrndS(NRmtrightRi( RR$RR\RRRRRER(RRR((R Rs  (sfileRG(RHRI(sdebugRJ(RKRL(RMRN(shelpRP(3RRaRRiRjR~RRWt IdleHistoryRoRTR"RsRRRRRRRuRvRgRxRhRzR{R?RRRRR`RRRRRhRRRdRfReRcRbRRR9RiRjRRR(((R RgsX  1                   >      RncBs8tZddZdZdZdZdZRS(NcCs(||_||_d|_||_dS(Ni(RQRRRR#(RRQRR#((R R"s   cCs|ii||idS(N(RRQRRR(RR((R RscCst|i|dS(N(tmapRRtl(RR((R t writelinesscCsdS(N((R((R tflushscCstS(N(R(R((R Rs(RRaRTR"RRRR(((R Rns     s USAGE: idle [-deins] [-t title] [file]* idle [-dns] [-t title] (-c cmd | -r file) [arg]* idle [-dns] [-t title] - [arg]* -h print this help message and exit -n run IDLE without a subprocess (see Help/IDLE Help for details) The following options will override the IDLE 'settings' configuration: -e open an edit window -i open a shell window The following options imply -i and will open a shell: -c cmd run the command in a shell, or -r file run script from file -d enable the debugger -s run $IDLESTARTUP or $PYTHONSTARTUP before anything else -t title set title of shell window A default edit window will be bypassed when -c, -r, or - are used. [arg]* are passed to the command (-c) or script (-r) in sys.argv[1:]. Examples: idle Open an edit window or shell depending on IDLE's configuration. idle foo.py foobar.py Edit the files, also open a shell if configured to start with shell. idle -est "Baz" foo.py Run $IDLESTARTUP or $PYTHONSTARTUP, edit foo.py, and open a shell window with the title "Baz". idle -c "import sys; print sys.argv" "foo" Open a shell window and run the command, passing "-c" in sys.argv[0] and "foo" in sys.argv[1]. idle -d -s -r foo.py "Hello World" Open a shell window, run a startup script, enable the debugger, and run foo.py, passing "foo.py" in sys.argv[0] and "Hello World" in sys.argv[1]. echo "import sys; print sys.argv" | idle - "foobar" Open a shell window, run the script piped in, passing '' in sys.argv[0] and "foobar" in sys.argv[1]. cCstat}t}t}d} d}t}y t i Wnt j odt _ nXy#t i t idd\}}WnOt ij o@}t iidt|t iitt idnXxB|D]:\} } | djo| } t}n| djot}t}n| djo t}n| d jot iitt in| d jo t}n| d jo tan| d jo:| }tii|ond G|GHt it}n| djot}t}n| djo| t_t}qqW|o*|ddjot i i!} t}nx=t"t#t iD]&} tii%t i| t i| i?|qn|o| p|od|i>i@dt if| o|i>iA| qm|o$|i>iB||i>i?|qmnt1iCt1iDdS(Ns>>> is c:deihnr:st:s Error: %s is-cs-ds-es-hs-is-ns-rsNo script file: s-ss-tit-RRpRseditor-on-startupRRt classNametIdlet IDLESTARTUPt PYTHONSTARTUPsbif 1: import sys as _sys _sys.argv = %r del _sys (ERRERt enable_shellt enable_editR<RTtcmdtscripttstartupRR~RtgetopttargvtoptsR#RR+RwRRQt usage_msgR_totaRvR*R+RURgRRsRR^RWR6tabspathtpathxR R8tdirnametdirR>tgetcwdR-Rzt edit_startRYRRZR[RdR(RKtnewR)R9RQR{tenvironR/R:RRRR(Rtdestroy(RRRRR R+RQR#RRRR6RRRR<R((R Rps #                     $         % R(<R*tos.pathRtstringRtreRRRt tracebackRt exceptionsRRRRt ImportErrorRR_RCR!RZtFileListRjRR\t configHandlerR-RtrpcRRt ascii_letterstdigitsR1RtsignalRRRR t showwarningRRRTt checkcacheRRRdRiR~t RPCClientRRRgRnRRpRR(*RZRRiRR~RR1RRRRRRgRRRRRpRRdR RRRR!RRRR\RRRnRRRR-RRjRCRRR*((R t?s|                                 5 u