Comment 2 for bug 929025

Revision history for this message
François Pinard (fpinard) wrote : Re: [Bug 929025] Re: opening Pymacs.py fails

Andreas Roehler <email address hidden> writes:

> Hi François,

Hello, Andreas.

> can't reproduce that kind of error. Maybe send the output of M-x
> report-emacs-bug, should it still happen.

OK, I'll do that, the next time I have some free time ahead and
reactivate python-mode to test it.

> As for the PYTHONPATH mentioned, don't see it's related to the error
> messages shown.

Sorry, I thought the traceback would have been sufficient. Let me try
to share more comments on it.

  Debugger entered--Lisp error: (wrong-type-argument stringp nil)
    string-match("/home/pinard/bureautique/emacs/_/python-mode/Pymacs"
    nil)

The second argument to string-match is nil, while it should be a
string. This comes from the beginning of function py-load-pymacs, which
reads:

  (let* ((pyshell (py-choose-shell))
         (path (getenv "PYTHONPATH"))
         (pymacs-installed-p
          (string-match (expand-file-name (concat py-install-directory "/Pymacs")) path)))

You see, that "nil" comes from the value of "path", which is computed
the line before as the value of "PYTHONPATH" in the environment. A
"nil" value means that "PYTHONPATH" is not defined in the environment.
So the bug is just in front of our eyes.

When you say you cannot reproduce the problem, did you unset
"PYTHONPATH" from your environment, prior to calling py-load-pymacs?

> Fetched your latest Pymacs files, thanks. Unfortunately with new
> pymacs.el get the error "Pymacs didn't start...". So won't change the
> tweaked inline Pymacs for the moment as it seems to work.

Does "make check" on the latest Pymacs works for you? If it does, but
does not work once within Python mode, the integration may be fishy.

> Should we get some Pymacs related bug report, being able to reproduce,
> that will change it...

You should not ought to tweak Pymacs. Untweak it (or just use the
recent one). If it does not work for you once you integrate it within
Python mode, you have your bug reproduced -- then make yourself a report
if you feel like it :-). If the bug is on the Pymacs side, I'll happily
correct it here, of course. Just email to me, and we will manage! :-)

It seems that going through run-python, PYTHONPATH is altered, so Pymacs
would likely work in there. (Yet, the code does not pay attention to
avoid doubling values along PYTHONPATH, which is an inefficiency.)
Maybe that some similar alteration might be used within py-load-pymacs?

François