Can I load a python program at the interactive >>> prompt?

Discussion in 'Python' started by walterbyrd, Dec 5, 2008.

  1. walterbyrd

    walterbyrd Guest

    I am running cygwin on xp.

    Much to my annoyance, I can not cut-and-paste from a windows app to
    the python prompt. I think I could do this with putty, but I do not
    have the permissions to install putty on my xp box.

    Can I load a file into the python interactive environment? For
    example I have a file called test.py that consists of the following:

    print "hello"
    print "hello again"

    Can I load that file into python at the >>> prompt?

    >>> load "test.py"


    or something like that?
    walterbyrd, Dec 5, 2008
    #1
    1. Advertising

  2. walterbyrd

    Tim Golden Guest

    walterbyrd wrote:
    > I am running cygwin on xp.
    >
    > Much to my annoyance, I can not cut-and-paste from a windows app to
    > the python prompt. I think I could do this with putty, but I do not
    > have the permissions to install putty on my xp box.


    I do this all the time. The key (altho' not strictly essential)
    is to access the console window Properties from the top-left drop-down
    menu and then on the first tab, select Quick Edit. With this, you
    can just right-click with the mouse and whatever you had in the
    clipboard (as long as it's text) will drop into your Python
    session. Whenever I'm posting code snippets here, I always
    copy them from the email and do what I've described to run
    them in a fresh interpreter session to make sure they work.

    >
    > Can I load a file into the python interactive environment? For
    > example I have a file called test.py that consists of the following:
    >
    > print "hello"
    > print "hello again"
    >
    > Can I load that file into python at the >>> prompt?
    >
    >>>> load "test.py"

    >
    > or something like that?



    Well, you can use execfile if you want.

    TJG
    Tim Golden, Dec 5, 2008
    #2
    1. Advertising

  3. walterbyrd

    Tim Golden Guest

    walterbyrd wrote:
    > I am running cygwin on xp.


    ..... and I just noticed this vital bit. So not sure
    how much of my other post applies. Sorry. Maybe it'll
    help anyway. :)

    TJG
    Tim Golden, Dec 5, 2008
    #3
  4. Tim Golden schrieb:
    > walterbyrd wrote:
    >> I am running cygwin on xp.

    >
    > .... and I just noticed this vital bit. So not sure
    > how much of my other post applies. Sorry. Maybe it'll
    > help anyway. :)



    Everything. The atrocity that the windows terminal window is isn't
    mitigated by an out-of-the-box cygwin. Did anybody *ever* need a
    rectangular marking mode?

    You could use rxvt. But that's also far from perfect.

    Diez
    Diez B. Roggisch, Dec 5, 2008
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gaurav kashyap
    Replies:
    2
    Views:
    616
    gaurav kashyap
    Oct 30, 2008
  2. gaurav kashyap
    Replies:
    3
    Views:
    685
    gaurav kashyap
    Oct 31, 2008
  3. John Machin
    Replies:
    14
    Views:
    598
    jhermann
    Dec 17, 2008
  4. Mel
    Replies:
    10
    Views:
    3,122
    Sailaja Appi
    Feb 13, 2009
  5. ~km
    Replies:
    3
    Views:
    381
Loading...

Share This Page