# -*- Mode: Python; tab-width: 4 -*- # requires the calldll module & library: # ftp://squirl.nightmare.com/pub/python/python-ext/calldll.zip import windll import calldll # Don't look, Ethel. p = windll.module ('python14') c = windll.module ('msvcrt40') s = windll.cstring ('') p.PyRun_InteractiveLoop (c._iob.address, s) # explanation: # _iob is the 'FILE *' array for stdio. # _iob[0] is 'stdin' # # I am therefore calling the Python function PyRun__InteractiveLoop # (aka run_tty_loop) directly. # # why? because when running as a subprocess under emacs, 'isatty' # returns false for stdin, and there doesn't seem to be any other way # of forcing python into interactive mode without hacking python # itself. # # -------------------------------------------------- # Stick this in your .emacs: # -------------------------------------------------- # # (defun py-shell () # (interactive) # (require 'comint) # (switch-to-buffer-other-window # (make-comint # "Python" # "z:\\python\\python.exe" # nil # "c:\\users\\rushing\\python\\interactive.py") # ) # (make-local-variable 'shell-prompt-pattern) # (setq shell-prompt-pattern "^>>> \\|^\\.\\.\\. ") # (set-process-filter (get-buffer-process (current-buffer)) # 'py-process-filter) # (set-syntax-table py-mode-syntax-table))