Issue #948 resolved

Jython: ImportError: No module named tty

Anonymous created an issue

Jython doesn't ship neither the tty nor the termios modules and that prevents the test suite to run. A fix is as follow:

{{{ Index: cherrypy/test/webtest.py =================================================================== --- cherrypy/test/webtest.py (révision 2485) +++ cherrypy/test/webtest.py (copie de travail) @@ -138,10 +138,17 @@

try: - # On Windows, msvcrt.getch reads a single char without output. - import msvcrt - def getchar(): - return msvcrt.getch() + # Jython support + if sys.platform[:4] == 'java': + from java.lang import System + def getchar(): + # Hopefully this is enough + return System.in.read() + else: + # On Windows, msvcrt.getch reads a single char without output. + import msvcrt + def getchar(): + return msvcrt.getch() except ImportError: # Unix getchr import tty, termios }}}

Reported by lawouach

Comments (3)

  1. Log in to comment