emacs 24: how/when do I load python-mode.el?

Asked by Jerry Asher

I am using emacs 24 on Windows.... And having a hard time figuring out when or how to load python-mode.el. I am a python newbie.

I installed python-mode.el with elpa, and apparently that gives me py-version 6.0.3.

Basically, I want to get to the point where when I start emacs, I can use py-shell to get me an interactive python shell.

It seems that installing python-mode with elpa is not sufficient, because if I do no more than install python-mode with elpa, than the function py-shell is not defined.

And so in my .emacs I have

(require 'python-mode)

But when I do this, my .emacs fails as python-mode cannot be found on a load path.

It seems, and I don't know why, that elpa loads packages AFTER .emacs has been loaded. So given that, I am unsure what I can do in .emacs to ensure that later on I can type m-x py-shell to start a shell.

So... Can you help?

Thank you,

Jerry

Question information

Language:
English Edit question
Status:
Solved
For:
python-mode.el Edit question
Assignee:
No assignee Edit question
Solved by:
Andreas Roehler
Solved:
Last query:
Last reply:
Revision history for this message
Jerry Asher (ja2038) said :
#1

Dan Jaouen at Stack Overflow reports something similar:

http://stackoverflow.com/a/10176706/608970

Note: For some reason, py-shell wasn't available the next time I loaded Emacs. I fixed this by adding:
(load "~/.emacs.d/elpa/python-mode-6.0.3/python-mode.el")

to the end of my .emacs file, although this is kind of hackish.

Revision history for this message
Best Andreas Roehler (a-roehler) said :
#2

Am 25.04.2012 11:06, schrieb Jerry Asher:
> Question #194668 on python-mode.el changed:
> https://answers.launchpad.net/python-mode/+question/194668
>
> Jerry Asher gave more information on the question:
> Dan Jaouen at Stack Overflow reports something similar:
>
> http://stackoverflow.com/a/10176706/608970
>
> Note: For some reason, py-shell wasn't available the next time I loaded Emacs. I fixed this by adding:
> (load "~/.emacs.d/elpa/python-mode-6.0.3/python-mode.el")
>
> to the end of my .emacs file, although this is kind of hackish.
>

thanks to notice us of elpa - will ask there how to keep it updated.

You should be better off using last release - look at the download button.
See INSTALL after unpacking - it's as easy as from elpa.

Revision history for this message
Jerry Asher (ja2038) said :
#3

Thanks Andreas Roehler, that solved my question.