Getting hello world to work in pymacs

319 Views Asked by At

Context: I have been using ropemacs for python and have pyemacs setup and working. I want to start programming emacs in python (I have some experience programming emacs in elisp). And I started off with hello world sample.

I have created ~/.emacs.d/hello.py with sample from the docs:

from Pymacs import lisp

def hello_world():
    lisp.insert("Hello from Python!")
hello_world.interaction = ''

I'm then trying to load hello.py in my init file:

(eval-after-load "pymacs"                             
  '(add-to-list 'pymacs-load-path "~/.emacs.d/"))
(pymacs-load "hello") ;;this line fails                            
(require 'hello)                                 

I get the following error. What am i doing wrong?

Debugger entered--Lisp error: (error "Pymacs loading hello...failed")          
  signal(error ("Pymacs loading hello...failed"))                              
  pymacs-report-error("Pymacs loading %s...failed" "hello")                    
  (cond (lisp-code (let ((result (eval lisp-code))) (message "Pymacs loading %$
  (let ((lisp-code (pymacs-call "pymacs_load_helper" module prefix))) (cond (l$
  pymacs-load("hello")                                                         
  eval((pymacs-load "hello") nil)                                              
  eval-last-sexp-1(nil)                                                        
  eval-last-sexp(nil)                                                          
1

There are 1 best solutions below

0
On

I maybe a bit late to the party but the reason is because you should make sure to reload the pymacs interpreter after adding a module to the pymacs-load-path, the easiest way to do that is to kill the Pymacs buffer and it should work after