1

I am new to Emacs (24). I installed the python-mode. And it's path name is "~/.emacs.d/python-mode-6.0.10 " . I have a "python-settings.el" file in "~/.emacs.d/settings/", it contains the following lines,

   ; python-mode
   (setq py-install-directory "~/.emacs.d/python-mode-6.0.11")
   (add-to-list 'load-path py-install-directory)
   (require 'python-mode)

In my .emacs file I have added,

   (add-to-list 'load-path "~/.emacs.d/settings")
   (require 'python-settings)

But when I try to load emacs ,I keep getting the error "Cannot Open load file "python-mode".

I don't know what's wrong.

0

2 Answers 2

1

(require 'python-mode) is right, as python-mode.el provides 'python-mode, not 'python.

Making sure your python-settings is loaded before python-mode is required, for example by a python-file, should avoid the error.

Also you might update python-mode.el, but that's rather not related.

Sign up to request clarification or add additional context in comments.

2 Comments

I am sorry but can you explain a bit elaborately ? Only my python-settings is requiring python-mode and I am requiring python-settings in my .emacs file. So python-settings can't be loaded after python-mode is required right ?
@user1955184 AFAIU your settings that seems correct. Hard to tell what's wrong from here. Just an experience from my own errors: sometimes it helps to find a way for the moment, coming back at the issue some times later. As a workaround you could use (load ...) from your emacs-init.
1

If M-: (require 'python-mode) gives you an error, then python-mode.el isn't in your load path; looking at your question again, I note that in the text you mention it being in ~/.emacs.d/python-mode-6.0.10, but your python-settings.el references ~/.emacs.d/python-mode-6.0.11 -- is it possible that's a typo in python-settings.el?

8 Comments

I tried this (replaced python-mode with python in my python-settings.el file),and I am getting an error telling python-settings not provided.
But why I should I use (require 'python) when I have specifically installed the python-mode package and put it in '~/.emacs.d/python-mode-6.0.11 ' . This uses ipython and I want emacs to be configured so that I can access the ipython interpreter from within emacs.
The argument passed to REQUIRE isn't a filename, but rather a symbol which matches one passed to PROVIDE in the code you're trying to load -- if python-mode.el includes (provide 'python), then the correct form of the REQUIRE call is (require 'python), with the same symbol as passed to PROVIDE. Similarly, if you're trying to (require 'python-settings), but nothing has called PROVIDE with that symbol, then you'll get an error -- add to the end of your python-settings.el file the form (provide 'python-settings), and the REQUIRE call with that symbol will start to work.
@user1955184 Per Andreas Röhler's answer, it looks like I was barking up the wrong tree; (require 'python-mode) is correct for the mode you're trying to use, and apologies for the error. If M-: (require 'python-mode) gives you an error, then python-mode.el isn't in your load path; looking at your question again, I note that in the text you mention it being in ~/.emacs.d/python-mode-6.0.10, but your python-settings.el references ~/.emacs.d/python-mode-6.0.11 -- is it possible that's a typo in python-settings.el?
@user1955184 Sure. But the point I'm making is that, if python-mode.el were in the directory that python-settings.el adds to your load path, then (require 'python-mode) wouldn't be erroring out. Can you double-check that python-mode.el is where python-settings.el expects it to be?
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.