Feed on

it’s been a bit of a hassle getting emacs to read python files in python-mode.  in spite of downloading a python-mode file and putting it in my boot path, emacs still refused to enter python mode.  i kept getting the error message:

file-error “Cannot open load file” “python-mode”

turns out the problem was that i needed to specify emacs’ own load-path, by inserting the following line into my .emacs file:

(add-to-list ‘load-path “/Users/user_name/bin/”)

where  “/Users/user_name/bin/” is the directory i’ve placed my python-mode.el file into.

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

9 Responses to “fixing emacs “cannot open load file” errors”

  1. on 20 Apr 2007 at 6:59 am Isabelle

    Thanks for the tip .. I was using wrong syntax for my path (C:\Users\…)

  2. on 02 Jul 2007 at 1:24 pm Krishnan

    Great! It worked for me for setting up the matlab mode.

  3. on 23 Aug 2007 at 10:09 am Rob Stewart

    Here’s a shell script I use:


    echo >&2 “$0 [-d directory [directory ...]] file.el [file.el ...]

    where is added to the load-path during compilation.”
    [ $# -eq 0 ] || echo >&2 ”
    exit 1

    while [ $# -gt 0 ]; do
    case $1 in
    –help|-h|-’?') usage;;
    [ $# -gt 1 ] || usage “Missing directory argument for -d”
    *) break;;

    for directory in $DIRECTORIES; do
    LOAD_PATH=”$LOAD_PATH –directory=$directory”

    for file in “$@”; do
    cd $(dirname $file)
    emacs -batch -no-init-file $LOAD_PATH -f batch-byte-compile $file

  4. on 28 Nov 2010 at 1:44 pm Tom

    Thanks for the tip, I thought (require ‘program) was all I needed.

  5. on 12 Oct 2011 at 9:35 am punya

    Thanks for the valuable information.
    It helped me to set matlab mode.

  6. on 16 Jul 2012 at 3:52 am Filippo


  7. on 25 Jul 2012 at 11:54 am duan5

    Thanks for the tip.

    It helped me fix a “cannot open load file: gnuplot” error for emacs org-mode Org-babel-gnuplot on MacOS.

    I had to add to my .emacs :

    (add-to-list ‘load-path “/opt/local/share/emacs/site-lisp/”)

    despite this path is the native installation path of
    Emacs on MacOSX.
    Emacs version 24.1.0, org-mode version 7.8.11

  8. on 05 Sep 2013 at 3:40 am Nils


    This worked for me. What not worked was symlinks from .emacs.d/ to the directory containing the *.el files.

  9. on 23 Sep 2014 at 7:36 pm Ahmed

    I thought I have to say thank you for sharing I have been trying to do so and with no success it was just frustrating .
    thanks again

Did I get this wrong? Let me know!

Trackback URI | Comments RSS