How do you call ActivePython from cygwin shell?

2

I installed ActivePython which is a Python version 3.x installation for Windows. I renamed the interpreter to be activepython.exe so as to allow calling it from cygwin without modifying /etc/profile path.

When I am in cmd.exe shell I can call ActivePython interpreter without arguments and enter interactive mode. When I execute the ActivePython interpreter from Cygwin shell, the shell just hangs indefinitely after hitting enter (similar to accounts seen by others here).

How do you call ActivePython from cygwin shell?

Trevor Boyd Smith

Posted 2013-08-13T14:29:10.960

Reputation: 2 093

Answers

4

Found a blog post with the solution here's a summary of the solution:

activepython -i

Notes:

  • In my case I have ActivePython interpreter on the path as activepython to allow me to call activepython instead of the cygwin installed python.
  • Tip: When you need to exit the interpreter Ctrl-D doesn't work. You need to do Ctrl-C and then the Cygwin shell freezes for 20 seconds before it becomes available again.
  • I found a second more authoritative source on this exact subject. This source is the Cygwin terminal mintty. Here the Cygwin developers are talking about the problem and they seem to talk about the low level issues with windows/mintty/python interpreter.
    • "This explicitly tells it to run in interactive mode. The reason it doesn't work otherwise is that it checks whether stdin is a console. With mintty and other pty-based terminals the answer is no, because Cygwin uses pipes to emulate ptys, so Python enters non-interactive mode."
    • "Unfortunately, not all Windows programs have a workaround like -i to force them to act interactively."

Trevor Boyd Smith

Posted 2013-08-13T14:29:10.960

Reputation: 2 093

I believe that the -i open's the interpreter in 'interactive' mode. Though I'm not for sure on this. – James Mertz – 2013-08-13T14:42:33.663

The -i is for interactive mode. But if you don't specify anything to the interpreter it usually enters interactive mode also. Which is I guess the reason for my question. – Trevor Boyd Smith – 2013-08-13T14:47:16.757

1

Making the cygwin shell run from within cmd.exe worked very well for me:

I sued the following shortcut (check the cygwin path matches)

%windir%\system32\cmd.exe /C C:\cygwin64\Cygwin.bat

Cygwin from within cmd.exe runs python without any odd problems

pev.hall

Posted 2013-08-13T14:29:10.960

Reputation: 111