Can I use Expect on Windows without installing Cygwin?
There is WExpect for Python.
Notes in the wexpect.py
file (typos unchanged and highlighting added)
Wexpect is a port of pexpext to Windows. Since python for Windows lacks
the requisite modules (pty, tty, select, termios, fctnl, and resource) to run
pexpect, it was necessary to create a back-end that implemented any functions
that were used that relied on these modules. Wtty.py is this back-end. In
the Windows world consoles are not homogeneous. They can use low level or high
level input and output functions, and to correctly deal with both cases two
child processes are created for instacne of Spawn, with an intermidate child
that can continuously read from the console, and send that data over a pipe
to an instance of wtty. Spawner.py is resposible from reading and piping
data.I've left as much code intact as I could and also tried to leave as many comments
intact is possible (espicially for functions that have not been changed) so many
of the comments will be misleading in their relationship to os specific
functionality. Also, the functions sendcontrol and sendeof are unimplemnted at
this time, as I could not find meaningful Windows versions of these functions.
additionally, consoles do not have associated fild descriptors on Windows, so the
global variable child_fd will always be None.
Windows Batch - Call Cygwin to Execute TCL Expect Script
Firstly, a true expect script cannot be executed by bash. Some people write code that is mixed between bash and expect — that's very Unix-ish, so much so that I'd expect even cygwin to have problems with it — but you're strongly advised to not do.
Fortunately, your script is indeed a true expect script. It should therefore be invoked from the cygwin shell as:
expect myscript.exp
Plus whatever paths are necessary.
The reason it fails when you do that is that ssh (possibly ssh.exe) is either not installed at all, or is not present on your PATH. Fix that by installing it or correcting your PATH; you can probably figure out which you need to do far more quickly than I can describe all the possibilities. (I personally prefer to use plink.exe from the PuTTY suite of programs when I need a scriptable SSH implementation on Windows, but that's entirely up to you.)
Expect-like tool for windows
Take a look at ActiveState's Tcl distribution which has a port of Expect for Windows.
Opening files from cygwin home in windows applications
Non-Cygwin Windows applications are not aware of your Cygwin root or home directory.
Emacs is a special case. It was originally developed on UNIX, and it uses UNIX-like syntax for some things.
According to your latest comment, Emacs expands ~
to C:\Users\Tudor
. That's your Windows home directory, not your Cygwin home directory.
You can also install a Cygwin version of Emacs, which, like any Cygwin application, will expand ~
to your Cygwin home directory.
If you invoke a Windows application from a Cygwin shell, then the shell, not the Windows application, will expand ~
to your Cygwin home directory, expressed in Cgywin syntax. For example, assuming runemacs
is a non-Cygwin application, if I run:
bash$ runemacs ~
then the shell expands the ~
, so it's equivalent to (assuming my user name is Tudor
):
bash$ runemacs /home/Tudor
runemacs
will probably treat /home/Tudor
as equivalent to \home\Tudor
, which would be equivalent to C:\home\Tudor
if the current drive is C:
.
If you type Ctrl-X Ctrl-F from within Emacs to open a file, then Emacs will interpret ~
according to whatever rules it follows internally; those rules aren't likely to recognize Cygwin unless you're running a Cygwin version of Emacs or Emacs itself has some special-case code to handle Cygwin paths.
How to run make from Cygwin environment?
You have to install the make
command.
Run the Cygwin installation/configuration program, setup-x86_64.exe
or setup-x86.exe
(you should already have it, downloaded from here). When you get to the screen that lets you select packages to install, find make
and select it (it's probably under "Development" or something similar).
Then you'll be able to run make
from the Cygwin bash command line.
Related Topics
No Such File or Directory "Limits.H" When Installing Pillow on Alpine Linux
Differencebetween Size and Count in Pandas
How to Convert a String to a Number If It Has Commas in It as Thousands Separators
Selenium with Scrapy for Dynamic Page
Create an Empty List with Certain Size in Python
How to Specify Multiple Return Types Using Type-Hints
How to Find the Mime Type of a File in Python
Slice 2D Array into Smaller 2D Arrays
Why Is the Id of a Python Class Not Unique When Called Quickly
Serving a Request from Gunicorn
List Comprehension Rebinds Names Even After Scope of Comprehension. Is This Right
Integer Division in Python 2 and Python 3
Setting Y-Axis Limit in Matplotlib
What Are the Differences Between Numpy Arrays and Matrices? Which One Should I Use
Python List in SQL Query as Parameter