<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Dec 5, 2008, at 15:52 , walterbyrd wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">Can I load a file into the python interactive environment?  For</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">example I have a file called test.py that consists of the following:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">print "hello"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">print "hello again"</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Can I load that file into python at the >>> prompt?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div> <blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">load "test.py"</div> </blockquote></blockquote></blockquote><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">or something like that?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><br></div></blockquote><br></div><div>I think you mean:</div><div><br></div><div>execfile('test.py')</div><div><br></div><div>that should work.  if you have iPython, which is a great shell for running python code, you can do:</div><div><br></div><div>run test.py</div><div><br></div><div>as far as copy/paste, I think in Windows Python runs in a DOS prompt, so you should be able to right-click and choose Edit/Paste.  Not too convenient, but I think it works.</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre">                  </span>bb<br></div><div><br></div><div><br></div><div><br></div><div> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>-- </div><div>Brian Blais</div><div><a href="mailto:bblais@bryant.edu">bblais@bryant.edu</a></div><div><a href="http://web.bryant.edu/~bblais">http://web.bryant.edu/~bblais</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span> </div><br></body></html>