[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problems with built-in Python mode of Emacs22 on w32
From: |
Stefan Monnier |
Subject: |
Re: Problems with built-in Python mode of Emacs22 on w32 |
Date: |
Mon, 10 Apr 2006 01:09:31 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> I searched the group, but it seems nobody encountered such a problem.
> I use Emacs22 (for windows), it has python.el in the distrib. Also I
> use Python 2.4.3.
Please use M-x report-emas-bug RET when reporting such problems.
> When I am trying to send a statement to Python from Emacs, *Python*
> buffer is shown and it says following:
> Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)]
> on win32
> Type "help", "copyright", "credits" or "license" for more information.
>>>> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File "c:\Program Files\Emacs\emacs\etc\emacs.py", line 23, in ?
> import os, sys, traceback, inspect, rlcompleter, __main__
> File "c:\Python24\lib\rlcompleter.py", line 42, in ?
> import readline
> ImportError: No module named readline
>>>> >>> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> NameError: name 'emacs' is not defined
>>>> >>>
Looking at this backtrace, I see that c:\python24\lib\rlcompleter.py
imported `readline' but that `readline' was not found. That sounds like an
internal problem in this installation of Python.
But googling around I see:
The rlcompleter module defines a completion function for the readline
module by completing valid Python identifiers and keywords.
This module is Unix-specific due to its dependence on the readline module.
If you look at ...emacs.../etc/emacs.py you'll see that it refers to
rlcompleter twice: once to import it, and another time in `complete' to
actually use it.
So I guess the best workaround (until the completion feature can be made to
actually work under w32) is to ignore the error at both places.
I've never written Python code so I have no idea if the patch below will
work (wrote it while looking at the online Python manual), but please try it
out and tell me what happens.
Stefan
--- emacs.py 07 fév 2006 12:22:26 -0500 1.6
+++ emacs.py 10 avr 2006 01:06:03 -0400
@@ -20,7 +20,10 @@
# Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
# Boston, MA 02110-1301, USA.
-import os, sys, traceback, inspect, rlcompleter, __main__
+import os, sys, traceback, inspect, __main__
+# The rlcompleter module seems to only be available in Unix for now.
+try: import rlcompleter
+except: pass
__all__ = ["eexecfile", "args", "complete", "ehelp", "eimport"]
@@ -69,8 +72,8 @@
"""Complete TEXT in NAMESPACE and print a Lisp list of completions.
NAMESPACE is currently not used."""
if namespace is None: namespace = __main__.__dict__
- c = rlcompleter.Completer (namespace)
try:
+ c = rlcompleter.Completer (namespace)
if '.' in text:
matches = c.attr_matches (text)
else: