Re: PExpect on Windows System Using Cygwin

Discussion in 'Python' started by Dave Angel, Sep 25, 2009.

  1. Dave Angel

    Dave Angel Guest

    Kevin Holleran wrote:
    > Hello,
    >
    > I downloaded and installed the pexpect module and wrote a script. All is
    > well and good, but the script proved to be pretty useful and now I was asked
    > to run it as a scheduled task up on a server to run periodically. I was
    > intending on simply packaging it up with Py2Exe and moving it to the server
    > that way.
    >
    > However, when I went to test it, I received this error....
    >
    > Traceback (most recent call last):
    > File "script.py", line 17, in <module>
    > import pexpect
    > File "lib\site-packages\pexpect.py", line 85, in <module>
    > support it. Pexpect is intended for UNIX-like operating systems.""")
    > ImportError: No module named resource
    >
    > A critical module was not found. Probably this operating system does not
    > support it. Pexpect is intended for UNIX-like operating systems.
    >
    > So now I realize that when I was testing on my system, I run cygwin and so
    > everything worked fine....
    >
    > Is there a .dll that I can copy with it or anything so that it works without
    > having to install cygwin on the server that will be hosting this scheduled
    > task?
    >
    > Thanks for any help.
    >
    > Kevin
    >
    >

    Why not just use the subprocess module? It's built into the Windows
    distribution, and doesn't need cygwin.

    DaveA
     
    Dave Angel, Sep 25, 2009
    #1
    1. Advertising

  2. Dave Angel

    Sean DiZazzo Guest

    On Sep 24, 4:37 pm, Dave Angel <> wrote:
    > Kevin Holleran wrote:
    > > Hello,

    >
    > > I downloaded and installed the pexpect module and wrote a script.  All is
    > > well and good, but the script proved to be pretty useful and now I was asked
    > > to run it as a scheduled task up on a server to run periodically.  I was
    > > intending on simply packaging it up with Py2Exe and moving it to the server
    > > that way.

    >
    > > However, when I went to test it, I received this error....

    >
    > > Traceback (most recent call last):
    > >   File "script.py", line 17, in <module>
    > >     import pexpect
    > >   File "lib\site-packages\pexpect.py", line 85, in <module>
    > >     support it. Pexpect is intended for UNIX-like operating systems..""")
    > > ImportError: No module named resource

    >
    > > A critical module was not found. Probably this operating system does not
    > > support it. Pexpect is intended for UNIX-like operating systems.

    >
    > > So now I realize that when I was testing on my system, I run cygwin and so
    > > everything worked fine....

    >
    > > Is there a .dll that I can copy with it or anything so that it works without
    > > having to install cygwin on the server that will be hosting this scheduled
    > > task?

    >
    > > Thanks for any help.

    >
    > > Kevin

    >
    > Why not just use the subprocess module?   It's built into the Windows
    > distribution, and doesn't need cygwin.
    >
    > DaveA


    Can subprocess pass things like passwords to running processes like
    pexpect can?

    ~Sean
     
    Sean DiZazzo, Sep 25, 2009
    #2
    1. Advertising

  3. Dave Angel

    Dave Angel Guest

    Sean DiZazzo wrote:
    > On Sep 24, 4:37 pm, Dave Angel <> wrote:
    >
    >>> <snip>
    >>>

    >> Why not just use the subprocess module? It's built into the Windows
    >> distribution, and doesn't need cygwin.
    >>
    >> DaveA
    >>

    >
    > Can subprocess pass things like passwords to running processes like
    > pexpect can?
    >
    > ~Sean
    >
    >

    I don't know what pexpect is/was capable of, since it's not apparently
    part of the current Python distributions. I thought it had the ability
    to fork or spawn a child process, with pipes connected.

    Anyway, subprocess can launch a new process, with pipes optionally
    connected back to your code. I don't think it can attach to an
    already-running process.

    There are things in pywin32 that might help (even for controlling GUI
    programs), but I suspect there'd be a big learning curve. And of course
    it'd then be very Windows-dependent.

    pywin32 - http://python.net/crew/skippy/win32/Downloads.html
    or get it as part of the ActiveState python distro.
    http://www.activestate.com/activepython/


    DaveA
     
    Dave Angel, Sep 25, 2009
    #3
    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. Replies:
    0
    Views:
    463
  2. Replies:
    0
    Views:
    434
  3. WELCOME to

    , Sep 3, 2003, in forum: Python
    Replies:
    1
    Views:
    515
    Robin Becker
    Sep 5, 2003
  4. =?ISO-8859-15?Q?J=F6rg?= Maier

    cygwin python with Tkinter and pexpect module

    =?ISO-8859-15?Q?J=F6rg?= Maier, Sep 6, 2003, in forum: Python
    Replies:
    2
    Views:
    540
    =?ISO-8859-15?Q?J=F6rg?= Maier
    Sep 7, 2003
  5. Saqib Ali
    Replies:
    1
    Views:
    363
    Roy Smith
    Dec 26, 2011
Loading...

Share This Page