[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Error running python interpreter under emacs on windows XP

From: Geoff Gole
Subject: Error running python interpreter under emacs on windows XP
Date: Mon, 8 Oct 2007 02:16:11 -0700

Starting the python interpreter under emacs 22 on windows XP currently
results in an error. A python instance inferior to emacs fails to load
scripts in PYTHONPATH that a standalone python loads happily:

(python running under emacs)
M-x run-python
>>> import emacs
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named emacs

(python running under cmd.exe)
>>> import emacs

This is possibly due to path handling in the function run-python in
python.el. At line 1354:

                (cons (concat "PYTHONPATH=" data-directory
---->                         (if path (concat ":" path)))

Since ":" won't work as a path delimiter under windows, perhaps this
is the issue. A potential fix is to replace ":" with

(if (or (eq system-type 'ms-dos)
        (eq system-type 'windows-nt))

Evaluating a temporary copy of run-python with the above replacement
seems to fix the issue on my system:

(python running under emacs, with above fix)
M-x run-python
>>> import emacs

This behaviour is consistent between my usual setup and an emacs -q session.

Using Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32
bit (Intel)] on win32

In GNU Emacs 22.0.990.1 (i386-mingw-nt5.1.2600)
 of 2007-05-23 on LENNART-69DE564 (patched)
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --cflags -Ic:/g/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENA
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Inferior Python

Minor modes in effect:
  server-mode: t
  binds: t
  compilation-shell-minor-mode: t
  delete-selection-mode: t
  encoded-kbd-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  noticeable-minibuffer-prompts-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  unify-8859-on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x r u n - p y t h o n <return> <C-down-mouse-1> i
m p o r t SPC e m a c s <return> M-x r e p o r t -
e m a c s - b u g <return>

Recent messages:
init-elisp-mode loaded: Emacs-lisp specific customisation
init-lisp-mode-common loaded: Customisation for lisp languages
init-lisp-interaction-mode loaded: Lisp-interaction specific customisation
For information about the GNU Project and its goals, type C-h C-p.
Loading python...done
Fontifying *Python*... (regexps..........)
Loading python...done
Loading emacsbug...done
call-interactively: End of buffer

reply via email to

[Prev in Thread] Current Thread [Next in Thread]