pinard/Pymacs

pymacs-load fails with python 3.2 reload

ricosaurus opened this issue · 14 comments

When testing pymacs-load with python3
eg
M-x pymacs-load RET
os RET RET

gives error "global name reload not defined" as reload in package imp for python 3.2

Edit: Pymacs version 0.24-beta2

A wild guess, could this be because you don't have the Python-side of Pymacs installed for Python 3.2? Try to run:

python3.2 -c "import pymacs"

As opposed to (for example):

python2.7 -c "import pymacs"

Hello. I just cannot reproduce the problem here, so I'm a bit lost about how I could help you on this one.

Did you try "make PYTHON=python3 check" on your side before you did "make PYTHON=python3 install" ? Did you obtain anymore clue? Could you give me some more hints?

François

I have a SyntaxError problem when byte-compiling pymacs.py by 'make PYTHON=python3 install' on OS X 10.7.2
Here's the log

make PYTHON=python3 install
python3 p4 -C p4config.py *.in Pymacs contrib tests
python3 setup.py install
running install
running build
running build_py
creating build
creating build/lib
creating build/lib/Pymacs
copying Pymacs/init.py -> build/lib/Pymacs
copying Pymacs/pymacs.py -> build/lib/Pymacs
running install_lib
byte-compiling /Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/Pymacs/pymacs.py to pymacs.pyc
File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/site-packages/Pymacs/pymacs.py", line 257
exec text
^
SyntaxError: invalid syntax

HynUx writes:

I have a SyntaxError problem when byte-compiling pymacs.py by 'make PYTHON=python3 install' on OS X 10.7.2
Here's the log

exec text
        ^

SyntaxError: invalid syntax

Hi, HynUx.

I'm rather surprised this error did not show until now! Merely replace
"exec text" with "exec(text)", installation should complete -- or at
least, go further! :-)

François

P.S. What is your real name? (and email and web site if any?)

Hi, François

I'm Hui Zhao, a R user new to python and github.

I made it with your advice! But I don't quite understand how this could happend for I noticed that the same pymacs.py files in pinard-Pymacs-016b0bc, where I compiled Pymacs, are of the right form.

And, to import Pymacs successfully, I have to replace
"from pymacs import Let, lisp by "from .pymacs import Let, lisp"
in init.py which I guessed from the same files in pinard-Pymacs-016b0bc.

Hui

Hello, Hui Zhao!

I replied a bit too quickly yesterday, being short on free time, but just took a better look a few minutes ago. My correction should not have been, as there was no error, but as it is innocuous, I'm not reverting it. There are two occurrences in the code which are now both "eval(text)", yet before, the first was "eval(text)" and the second "eval text". The first is compiled in Python 3 only, the second is compiled in Python 2 only. So, you should not have got the error you saw, and I'm surprised. Mystery! Could it be some interference with some previous Pymacs installation, or installation attempt? Or maybe the consequence of a corrected clock skew? I do not know.

At level 016b0bc, Pymacs installed a Python package, yet more recently, the package is gone and Pymacs now installs a single Python file, and the init.py file does not exist anymore. It's more simple that way for those other packages wanting to include Pymacs (provided they take care of pre-processing in a way or another).

François

Hi François,

Now I can run 'from Pymacs import lisp' without error in python 3.2.2, but always fail when evaling
(pymacs-load "ropemacs" "rope-") in my .emacs file and 'M-x pymacs-eval',
it says 'pymacs-report-error: Pymacs helper did not start within 30 seconds'

What's wrong with my Pymacs? and should I update to the latest version?

Hui

Hello, Hui.

You may update to the latest version if you feel like it. It is normally stable even if marked -beta. However, I just accepted a few small patches, this evening, which are not overly tested yet. I would take that risk in our place, I guess. It would at least allow you to take some distance from the problems relative to Pymacs as a Python "package" :-).

I do not know why the Pymacs helper did not start. A common cause is an installation problem, by which the proper Python interpreter is not found. Notice the very same Pymacs installation may not work for both Python 2 and Python 3 at once, it has to be installed separately for each Python version. Maybe the installation documentation does not stress this enough? (If this is indeed the problem and you feel the documentation mislead you, please help me at understanding how I could improve it.)

I'm not much familiar with Rope, so I do not know if the problem might come from there. I would not be tempted to think so, as the failure you observe likely happens much before Rope even gets loaded. The installation instructions suggest a few quick check to see if the installation succeeded. Did you try them? Tell me how I could help you better on this one.

François

Hi, everybody. With no more feedback on this problem, I'll "close this issue", not being able to go further on it. Presumably, GitHub will reopen it automatically if someone adds some more comment?

However, I recently got a 'pymacs-report-error: Pymacs helper did not start within 30 seconds' myself, after I acquired a new machine and installed a flurry of software on it. The problem in my case turned out to come from python-mode.el (I use a development copy), which provides its own older copy of Pymacs, yielding some confusion at run time. My problem vanished merely by commenting out python-mode.el initialization. I'll likely talk into Andreas Röhler about this.

yyr commented

I have nothing to add to this bug report.

But I doubt your assumption that github will reopen a bug if someone comments on a closed issue.
lets see weather this bug will be reopened automatically by this comment.

Regarding python-mode.el distributing it's own version of pymacs.

I have (setq py-load-pymacs-p 'nil) in my .emacs to disable python-mode.el from loading that version.

yyr: No GitHub did not reopen the bug report, but I did receive your message as usual email, so at least, nothing is lost. Thanks for trying and telling me. I see a "Reopen" button however, I presume you saw it as well, and that you could have used it (I mean, that there is no permission problem and that anybody can reopen an issue).

holmboe: Thanks, it works!!