Python & Expect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jeff Wagner

    Python & Expect

    Is there an Expect-like module for Python that is cross platform and, for the most part, does what
    Expect does? A number of years ago, I wrote some Tcl scripts using Expect for automation. I am
    trying to convince my good friend who I worked with at the time to try Python. He said, "what about
    Expect?"

    I have heard of a Pexpect but was told that it didn't run on win32 and he needs win32 and Linux
    support both.

    Thanks,
    Jeff
  • Peter Hansen

    #2
    Re: Python & Expect

    Jeff Wagner wrote:[color=blue]
    >
    > Is there an Expect-like module for Python that is cross platform and, for the most part, does what
    > Expect does? A number of years ago, I wrote some Tcl scripts using Expect for automation. I am
    > trying to convince my good friend who I worked with at the time to try Python. He said, "what about
    > Expect?"
    >
    > I have heard of a Pexpect but was told that it didn't run on win32 and he needs win32 and Linux
    > support both.[/color]

    Hmmm... let's see what Google brings up... (typing)



    Wow! Look at that! Pexpect is the first hit. Let's try accessing that
    page and see what it says. (click) Ah, there's a "Requiremen ts" link: (click)

    --------------------------------------------
    Python
    Pexpect was written and tested with Python 2.1. It should work on earlier versions
    that have the pty module. ...

    pty module
    Any POSIX system (UNIX) with a working pty module should be able to run Pexpect.
    The pty module is part of the Standard Python Library, so if you are running on
    a POSIX system you should have it. The pty module does not run as well on all platforms.
    I have taken effort to try to smooth the wrinkles out the different platforms. To
    learn more about the wrinkles see Bugs and Testing.

    Pexpect does not currently work on the standard Windows Python(see the pty requirement);
    however, it seems to work fine using Cygwin. ...

    --------------------------------------------

    Okay, Jeff, consider your wrist slapped for not even trying... :-)

    -Peter

    Comment

    • Jeff Wagner

      #3
      Re: Python & Expect

      On Wed, 10 Dec 2003 08:57:18 -0500, Peter Hansen <peter@engcorp. com> wrotf:
      [color=blue]
      >Jeff Wagner wrote:[color=green]
      >>
      >> Is there an Expect-like module for Python that is cross platform and, for the most part, does what
      >> Expect does? A number of years ago, I wrote some Tcl scripts using Expect for automation. I am
      >> trying to convince my good friend who I worked with at the time to try Python. He said, "what about
      >> Expect?"
      >>
      >> I have heard of a Pexpect but was told that it didn't run on win32 and he needs win32 and Linux
      >> support both.[/color]
      >
      >Hmmm... let's see what Google brings up... (typing)
      >
      >http://www.google.com/search?q=python+expect
      >
      >Wow! Look at that! Pexpect is the first hit. Let's try accessing that
      >page and see what it says. (click) Ah, there's a "Requiremen ts" link: (click)
      >
      >--------------------------------------------
      >Python
      >Pexpect was written and tested with Python 2.1. It should work on earlier versions
      >that have the pty module. ...
      >
      >pty module
      >Any POSIX system (UNIX) with a working pty module should be able to run Pexpect.
      >The pty module is part of the Standard Python Library, so if you are running on
      >a POSIX system you should have it. The pty module does not run as well on all platforms.
      >I have taken effort to try to smooth the wrinkles out the different platforms. To
      >learn more about the wrinkles see Bugs and Testing.
      >
      >Pexpect does not currently work on the standard Windows Python(see the pty requirement);
      >however, it seems to work fine using Cygwin. ...
      >
      >--------------------------------------------
      >
      >Okay, Jeff, consider your wrist slapped for not even trying... :-)
      >
      >-Peter[/color]

      Ouch ;)

      Ok, I did look at it and mentioned in my post that Pexpect doesn't run on win32. The question was,
      is there a Expect-like module that does run on win32. I couldn't find one.

      Jeff

      Comment

      • Cameron Laird

        #4
        Re: Python &amp; Expect

        In article <nkjetvod84erkm h6f0098lvac6hli fgaha@4ax.com>,
        Jeff Wagner <JWagner@hotmai l.com> wrote:[color=blue]
        >On Wed, 10 Dec 2003 08:57:18 -0500, Peter Hansen <peter@engcorp. com> wrotf:
        >[color=green]
        >>Jeff Wagner wrote:[color=darkred]
        >>>
        >>> Is there an Expect-like module for Python that is cross platform and,[/color][/color]
        >for the most part, does what[color=green][color=darkred]
        >>> Expect does? A number of years ago, I wrote some Tcl scripts using[/color][/color]
        >Expect for automation. I am[color=green][color=darkred]
        >>> trying to convince my good friend who I worked with at the time to[/color][/color]
        >try Python. He said, "what about[color=green][color=darkred]
        >>> Expect?"
        >>>
        >>> I have heard of a Pexpect but was told that it didn't run on win32[/color][/color]
        >and he needs win32 and Linux[color=green][color=darkred]
        >>> support both.[/color][/color][/color]

        Comment

        • Luther Barnum

          #5
          Re: Python &amp; Expect

          Instead of being the newsgroup cop, maybe you should use a little humility
          and actually read the post. It's guys like you that scare newbies from
          newsgroups. I'll bet you didn't know everything when you posted your last
          question.

          Luther


          "Peter Hansen" <peter@engcorp. com> wrote in message
          news:3FD7263E.1 10F9CC4@engcorp .com...[color=blue]
          > Jeff Wagner wrote:[color=green]
          > >
          > > Is there an Expect-like module for Python that is cross platform and,[/color][/color]
          for the most part, does what[color=blue][color=green]
          > > Expect does? A number of years ago, I wrote some Tcl scripts using[/color][/color]
          Expect for automation. I am[color=blue][color=green]
          > > trying to convince my good friend who I worked with at the time to try[/color][/color]
          Python. He said, "what about[color=blue][color=green]
          > > Expect?"
          > >
          > > I have heard of a Pexpect but was told that it didn't run on win32 and[/color][/color]
          he needs win32 and Linux[color=blue][color=green]
          > > support both.[/color]
          >
          > Hmmm... let's see what Google brings up... (typing)
          >
          > http://www.google.com/search?q=python+expect
          >
          > Wow! Look at that! Pexpect is the first hit. Let's try accessing that
          > page and see what it says. (click) Ah, there's a "Requiremen ts" link:[/color]
          (click)[color=blue]
          >
          > --------------------------------------------
          > Python
          > Pexpect was written and tested with Python 2.1. It should work on earlier[/color]
          versions[color=blue]
          > that have the pty module. ...
          >
          > pty module
          > Any POSIX system (UNIX) with a working pty module should be able to run[/color]
          Pexpect.[color=blue]
          > The pty module is part of the Standard Python Library, so if you are[/color]
          running on[color=blue]
          > a POSIX system you should have it. The pty module does not run as well on[/color]
          all platforms.[color=blue]
          > I have taken effort to try to smooth the wrinkles out the different[/color]
          platforms. To[color=blue]
          > learn more about the wrinkles see Bugs and Testing.
          >
          > Pexpect does not currently work on the standard Windows Python(see the pty[/color]
          requirement);[color=blue]
          > however, it seems to work fine using Cygwin. ...
          >
          > --------------------------------------------
          >
          > Okay, Jeff, consider your wrist slapped for not even trying... :-)
          >
          > -Peter
          >[/color]


          Comment

          • Peter Hansen

            #6
            OT: Peter Hansen needs to use some humility (was Re: Python &amp; Expect)

            Luther Barnum wrote:[color=blue]
            >
            > Instead of being the newsgroup cop, maybe you should use a little humility
            > and actually read the post. It's guys like you that scare newbies from
            > newsgroups. I'll bet you didn't know everything when you posted your last
            > question.[/color]

            Hmmm... I thought it was guys like me that answer dozens of questions
            every week from newbies and others, but maybe I mistook me for someone else.

            I did read Jeff's message, though, twice (once before responding, once
            before sending). The second time I read it, I noticed (again) that he was
            apparently aware that Pexpect did not work under Windows, but note his words:
            "I have heard of Pexpect but was told".... a very clear indication that
            he didn't know the real and full story, and hadn't visited the site. I tried
            to provide in a somewhat humorous way the hint that "Google is your friend",
            and I don't think he took offense (nor was any intended). Note also that
            my response actually provided additional information as well: the fact that
            Pexpect *does* "work fine using cygwin" under Windows, which apparently
            Jeff didn't know either.

            Yes, I could probably use a little humility, but I don't think you're
            attacking me on the right issue here since I did read the post quite
            thoroughly.

            And no, I "didn't know everything" when I last asked a question here(*),
            but I would have visited Google for a while before I did.

            I apologize if I scare you, but I don't apologize for making repeated
            reminders from time to time that people should do the initial legwork
            themselves before asking. Nor, for that matter, do I apologize for
            playing "net cop" from time to time and asking people to post test
            messages elsewhere, to avoid cross-posting, to remember to change the
            subject line when they change the subject, etc. etc. One reason Usenet
            has gotten hard to use at times is because of the huge influx of newbies
            and a lack of courage on the part of the oldsters to try to educate them
            more often on proper netiquette.

            -Peter

            (*) I don't remember the last time I asked a question, but I believe it
            was several months ago. I asked another one sometime last year, and I
            think I've asked two others before that. One the other hand, I've posted
            roughly ... let's see what Google says ... about 3,190 messages here in
            the last three years. And I happen to believe a few of those have actually
            helped people... While I actually appreciate attempts to improve my own
            behaviour when I'm out of line, I'm fairly certain that I wasn't this time.

            Comment

            • Cameron Laird

              #7
              Re: OT: Peter Hansen needs to use some humility (was Re: Python &amp; Expect)

              In article <3FD7906E.13832 168@engcorp.com >,
              Peter Hansen <peter@engcorp. com> wrote:

              Comment

              • Fredrik Lundh

                #8
                Re: OT: Peter Hansen needs to use some humility (was Re: Python&amp;Expe ct)

                Cameron Laird wrote:
                [color=blue]
                > Long term, the latter might be a greater benefit. I know how
                > much it means to me when someone helps me learn how to use
                > resources better.[/color]

                who has time to learn? wasn't the internet supposed to
                eliminate all that?

                </F>




                Comment

                • Peter Hansen

                  #9
                  Re: OT: Peter Hansen needs to use some humility (was Re: Python&amp;Expe ct)

                  Fredrik Lundh wrote:[color=blue]
                  >
                  > Cameron Laird wrote:
                  >[color=green]
                  > > Long term, the latter might be a greater benefit. I know how
                  > > much it means to me when someone helps me learn how to use
                  > > resources better.[/color]
                  >
                  > who has time to learn? wasn't the internet supposed to
                  > eliminate all that?[/color]



                  ;-)

                  Comment

                  • Cameron Laird

                    #10
                    Re: OT: Peter Hansen needs to use some humility (was Re: Python&amp;Expe ct)

                    In article <3FD876B8.74E1A BE1@engcorp.com >,
                    Peter Hansen <peter@engcorp. com> wrote:[color=blue]
                    >Fredrik Lundh wrote:[color=green]
                    >>
                    >> Cameron Laird wrote:
                    >>[color=darkred]
                    >> > Long term, the latter might be a greater benefit. I know how
                    >> > much it means to me when someone helps me learn how to use
                    >> > resources better.[/color]
                    >>
                    >> who has time to learn? wasn't the internet supposed to
                    >> eliminate all that?[/color]
                    >
                    >http://www.google.com/search?q=how+t...sources+better
                    >
                    >;-)[/color]

                    <URL: http://www.unixreview.com/documents/s=8472/ur0308i/ >, back at you.
                    --

                    Cameron Laird <claird@phaseit .net>
                    Business: http://www.Phaseit.net

                    Comment

                    Working...