Can Python replace TCL/Expect

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • xinchenvn@gmail.com

    #1

    Can Python replace TCL/Expect

    Hi

    I'm learning Python. I don't know whether Python can do something like
    Expect can do. If yes, please show me how to do it.
    I want to do something automatically: open connection to a ftp server,
    get the welcome message on the screen (not in the packet). I can do it
    easily with Expect but I still don't have any idea with Python.
    If possible, can you introduce me some book or website that I can get
    infor about automation programming with Python

    Thanks

  • Robert Kern

    #2
    Re: Can Python replace TCL/Expect

    xinchenvn@gmail .com wrote:[color=blue]
    > Hi
    >
    > I'm learning Python. I don't know whether Python can do something like
    > Expect can do. If yes, please show me how to do it.
    > I want to do something automatically: open connection to a ftp server,
    > get the welcome message on the screen (not in the packet). I can do it
    > easily with Expect but I still don't have any idea with Python.
    > If possible, can you introduce me some book or website that I can get
    > infor about automation programming with Python[/color]

    You'll probably want to take a look at pexpect:

    Download Pexpect - Pure Python Expect-like module for free. Pexpect is a Python module for spawning child applications; controlling them;


    --
    Robert Kern
    rkern@ucsd.edu

    "In the fields of hell where the grass grows high
    Are the graves of dreams allowed to die."
    -- Richard Harter

    Comment

    • Cameron Laird

      #3
      Re: Can Python replace TCL/Expect

      In article <mailman.1583.1 128579857.509.p ython-list@python.org >,
      Robert Kern <robert.kern@gm ail.com> wrote:[color=blue]
      >xinchenvn@gmai l.com wrote:[color=green]
      >> Hi
      >>
      >> I'm learning Python. I don't know whether Python can do something like
      >> Expect can do. If yes, please show me how to do it.
      >> I want to do something automatically: open connection to a ftp server,
      >> get the welcome message on the screen (not in the packet). I can do it
      >> easily with Expect but I still don't have any idea with Python.
      >> If possible, can you introduce me some book or website that I can get
      >> infor about automation programming with Python[/color]
      >
      >You'll probably want to take a look at pexpect:
      >
      > http://pexpect.sourceforge.net/[/color]

      Comment

      • Jorgen Grahn

        #4
        Re: Can Python replace TCL/Expect

        On Thu, 06 Oct 2005 11:08:09 GMT, Cameron Laird <claird@lairds. us> wrote:[color=blue]
        > In article <mailman.1583.1 128579857.509.p ython-list@python.org >,
        > Robert Kern <robert.kern@gm ail.com> wrote:[color=green]
        >>xinchenvn@gma il.com wrote:[color=darkred]
        >>> Hi
        >>>
        >>> I'm learning Python. I don't know whether Python can do something like
        >>> Expect can do. If yes, please show me how to do it.[/color][/color][/color]
        ....[color=blue]
        > 2. While Pexpect indeed "can do something like Expect",
        > it does NOT have all the facilities and polish of the
        > latter.
        > 3. But very, VERY few of Expect's users are aware of more
        > than a handful of Expect's functions, let alone use them,
        > so it's fair to say that Pexpect does everything Expect
        > does, within the realm of ordinary use.[/color]

        It depends. I do not feel /that/ advanced, but I've been bitten by pexpect's
        limitations several times in several places.

        .... which puts me in a weird position ;-) I /loathe/ the Tcl language, but I
        have to admit that its expect functionality is far superior to Python's.

        /Jorgen

        --
        // Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
        \X/ algonet.se> R'lyeh wgah'nagl fhtagn!

        Comment

        • Cameron Laird

          #5
          Re: Can Python replace TCL/Expect

          In article <slrndkae7r.2ss .jgrahn-nntq@frailea.sa .invalid>,
          Jorgen Grahn <jgrahn-nntq@algonet.se > wrote:

          Comment

          • Jorgen Grahn

            #6
            Re: Can Python replace TCL/Expect

            On Thu, 06 Oct 2005 17:08:03 GMT, Cameron Laird <claird@lairds. us> wrote:[color=blue]
            > In article <slrndkae7r.2ss .jgrahn-nntq@frailea.sa .invalid>,
            > Jorgen Grahn <jgrahn-nntq@algonet.se > wrote:
            > .
            > .
            > .[color=green]
            >>It depends. I do not feel /that/ advanced, but I've been bitten by pexpect's
            >>limitations several times in several places.
            >>
            >>... which puts me in a weird position ;-) I /loathe/ the Tcl language, but I
            >>have to admit that its expect functionality is far superior to Python's.[/color]
            > .
            > .
            > .[/color]
            [color=blue]
            > On to more constructive matters: what are you doing about
            > Pexpect's limitations? Have the maintainers responded to you
            > when you write? Are you tempted to compose enhancements for
            > yourself?[/color]

            There is hobby hacking, and there is work. I've encountered pexpect during
            work, and haven't had the time and energy to look into it. I hereby
            apologize to the pexpect developers. Not for whining, but for not helping
            out.

            /Jorgen

            --
            // Jorgen Grahn <jgrahn@ Ph'nglui mglw'nafh Cthulhu
            \X/ algonet.se> R'lyeh wgah'nagl fhtagn!

            Comment

            Working...