emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Getting source code to work
@ 2012-08-01 18:51 Mark Stoehr
  2012-08-01 19:07 ` Thomas S. Dye
  2012-08-01 19:11 ` Nick Dokos
  0 siblings, 2 replies; 9+ messages in thread
From: Mark Stoehr @ 2012-08-01 18:51 UTC (permalink / raw)
  To: emacs-orgmode

Hi,  I'm trying to include python source code in my document and I'm
finding that org-babel-execute-buffer ( as well as C-c C-c at the end
of a code block) does not successfully run my code, instead I get an
error "Invalid function: org-save-outline-visibility".  I saw messages
earlier

http://thread.gmane.org/gmane.emacs.orgmode/28048/focus=28049

regarding an apparently similar problem but my understanding of emacs
lisp is insufficient for me to make sense of it.  My program:

#+BEGIN_SRC python
print "Hello World"
return 1+2
#+END_SRC


I also have trouble getting tangle to work. With the following problem


#+BEGIN_SRC python :tangle yes
print "Hello World"
return 1+2
#+END_SRC

both C-c C-v t and M-x org-babel-tangle fail saying that 0 blocks have
been tangled.  I also tried the examples with the #+BEGIN_SRC and
#+END_SRC being in lowercase and that didn't change anything.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 18:51 Getting source code to work Mark Stoehr
@ 2012-08-01 19:07 ` Thomas S. Dye
  2012-08-01 19:11   ` Mark Stoehr
  2012-08-01 19:11 ` Nick Dokos
  1 sibling, 1 reply; 9+ messages in thread
From: Thomas S. Dye @ 2012-08-01 19:07 UTC (permalink / raw)
  To: Mark Stoehr; +Cc: emacs-orgmode

Aloha Mark,

Mark Stoehr <stoehr@cs.uchicago.edu> writes:

> Hi,  I'm trying to include python source code in my document and I'm
> finding that org-babel-execute-buffer ( as well as C-c C-c at the end
> of a code block) does not successfully run my code, instead I get an
> error "Invalid function: org-save-outline-visibility".  I saw messages
> earlier
>
> http://thread.gmane.org/gmane.emacs.orgmode/28048/focus=28049
>
> regarding an apparently similar problem but my understanding of emacs
> lisp is insufficient for me to make sense of it.  My program:
>
> #+BEGIN_SRC python
> print "Hello World"
> return 1+2
> #+END_SRC
>
>
> I also have trouble getting tangle to work. With the following problem
>
>
> #+BEGIN_SRC python :tangle yes
> print "Hello World"
> return 1+2
> #+END_SRC
>
> both C-c C-v t and M-x org-babel-tangle fail saying that 0 blocks have
> been tangled.  I also tried the examples with the #+BEGIN_SRC and
> #+END_SRC being in lowercase and that didn't change anything.
>
>

Your source code block evaluates fine on my setup:

#+BEGIN_SRC python
print "Hello World"
return 1+2
#+END_SRC

#+RESULTS:
: 3

The error message you are getting refers to a bug that was apparently
fixed some time ago.  What version of Org mode are you running?

Also, did you tell Org mode that you will be evaluating Python code?
You should have something like this in .emacs:

  (org-babel-do-load-languages
   'org-babel-load-languages
   '((R . t)
     (C . t)
     (ditaa . t)
     (dot . t)
     (emacs-lisp . t)
     (gnuplot . nil)
     (haskell . nil)
     (latex . t)
     (lisp . t)
     (ocaml . nil)
     (org . t)
     (perl . t)
     (python . t)  # This is the line you'll need
     (ruby . nil)
     (screen . nil)
     (sh . t)
     (sql . nil)
     (sqlite . t)))

hth,
Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 19:07 ` Thomas S. Dye
@ 2012-08-01 19:11   ` Mark Stoehr
  2012-08-01 19:48     ` Thomas S. Dye
  2012-08-01 22:27     ` Rasmus
  0 siblings, 2 replies; 9+ messages in thread
From: Mark Stoehr @ 2012-08-01 19:11 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: emacs-orgmode

Thanks Tom,

I do have

(org-babel-do-load-languages
 'org-babel-load-languages '((python . t)
			     (R . t)))

in my ~/.emacs.d/init.el

and my version (from M-x org-version) is
Org-mode version 7.8.11

Cheers,
Mark

On Wed, Aug 1, 2012 at 2:07 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
> Aloha Mark,
>
> Mark Stoehr <stoehr@cs.uchicago.edu> writes:
>
>> Hi,  I'm trying to include python source code in my document and I'm
>> finding that org-babel-execute-buffer ( as well as C-c C-c at the end
>> of a code block) does not successfully run my code, instead I get an
>> error "Invalid function: org-save-outline-visibility".  I saw messages
>> earlier
>>
>> http://thread.gmane.org/gmane.emacs.orgmode/28048/focus=28049
>>
>> regarding an apparently similar problem but my understanding of emacs
>> lisp is insufficient for me to make sense of it.  My program:
>>
>> #+BEGIN_SRC python
>> print "Hello World"
>> return 1+2
>> #+END_SRC
>>
>>
>> I also have trouble getting tangle to work. With the following problem
>>
>>
>> #+BEGIN_SRC python :tangle yes
>> print "Hello World"
>> return 1+2
>> #+END_SRC
>>
>> both C-c C-v t and M-x org-babel-tangle fail saying that 0 blocks have
>> been tangled.  I also tried the examples with the #+BEGIN_SRC and
>> #+END_SRC being in lowercase and that didn't change anything.
>>
>>
>
> Your source code block evaluates fine on my setup:
>
> #+BEGIN_SRC python
> print "Hello World"
> return 1+2
> #+END_SRC
>
> #+RESULTS:
> : 3
>
> The error message you are getting refers to a bug that was apparently
> fixed some time ago.  What version of Org mode are you running?
>
> Also, did you tell Org mode that you will be evaluating Python code?
> You should have something like this in .emacs:
>
>   (org-babel-do-load-languages
>    'org-babel-load-languages
>    '((R . t)
>      (C . t)
>      (ditaa . t)
>      (dot . t)
>      (emacs-lisp . t)
>      (gnuplot . nil)
>      (haskell . nil)
>      (latex . t)
>      (lisp . t)
>      (ocaml . nil)
>      (org . t)
>      (perl . t)
>      (python . t)  # This is the line you'll need
>      (ruby . nil)
>      (screen . nil)
>      (sh . t)
>      (sql . nil)
>      (sqlite . t)))
>
> hth,
> Tom
>
> --
> Thomas S. Dye
> http://www.tsdye.com
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 18:51 Getting source code to work Mark Stoehr
  2012-08-01 19:07 ` Thomas S. Dye
@ 2012-08-01 19:11 ` Nick Dokos
  2012-08-01 19:18   ` Mark Stoehr
  1 sibling, 1 reply; 9+ messages in thread
From: Nick Dokos @ 2012-08-01 19:11 UTC (permalink / raw)
  To: Mark Stoehr; +Cc: emacs-orgmode

Mark Stoehr <stoehr@cs.uchicago.edu> wrote:

> Hi,  I'm trying to include python source code in my document and I'm
> finding that org-babel-execute-buffer ( as well as C-c C-c at the end
> of a code block) does not successfully run my code, instead I get an
> error "Invalid function: org-save-outline-visibility".  I saw messages
> earlier
> 
> http://thread.gmane.org/gmane.emacs.orgmode/28048/focus=28049
> 
> regarding an apparently similar problem but my understanding of emacs
> lisp is insufficient for me to make sense of it.  My program:
> 
> #+BEGIN_SRC python
> print "Hello World"
> return 1+2
> #+END_SRC
> 
> 
> I also have trouble getting tangle to work. With the following problem
> 
> 
> #+BEGIN_SRC python :tangle yes
> print "Hello World"
> return 1+2
> #+END_SRC
> 
> both C-c C-v t and M-x org-babel-tangle fail saying that 0 blocks have
> been tangled.  I also tried the examples with the #+BEGIN_SRC and
> #+END_SRC being in lowercase and that didn't change anything.
> 

Cannot reproduce either problem: the code block produces a

#+RESULTS:
: 3

and the tangle says:

tangled 1 code block from mark-stoehr.org

Nick

Version info:

Org-mode version 7.8.11 (release_7.8.11-260-ga15b7d @ /home/nick/elisp/org-mode/lisp/)
(includes a few local commits)

GNU Emacs 24.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-07-28

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 19:11 ` Nick Dokos
@ 2012-08-01 19:18   ` Mark Stoehr
  2012-08-01 19:58     ` Eric Schulte
  2012-08-01 20:00     ` Nick Dokos
  0 siblings, 2 replies; 9+ messages in thread
From: Mark Stoehr @ 2012-08-01 19:18 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode

I just installed emacs and org-mode on a new machine, do you have any
suggestions for debugging this?

Mark

On Wed, Aug 1, 2012 at 2:11 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> Mark Stoehr <stoehr@cs.uchicago.edu> wrote:
>
>> Hi,  I'm trying to include python source code in my document and I'm
>> finding that org-babel-execute-buffer ( as well as C-c C-c at the end
>> of a code block) does not successfully run my code, instead I get an
>> error "Invalid function: org-save-outline-visibility".  I saw messages
>> earlier
>>
>> http://thread.gmane.org/gmane.emacs.orgmode/28048/focus=28049
>>
>> regarding an apparently similar problem but my understanding of emacs
>> lisp is insufficient for me to make sense of it.  My program:
>>
>> #+BEGIN_SRC python
>> print "Hello World"
>> return 1+2
>> #+END_SRC
>>
>>
>> I also have trouble getting tangle to work. With the following problem
>>
>>
>> #+BEGIN_SRC python :tangle yes
>> print "Hello World"
>> return 1+2
>> #+END_SRC
>>
>> both C-c C-v t and M-x org-babel-tangle fail saying that 0 blocks have
>> been tangled.  I also tried the examples with the #+BEGIN_SRC and
>> #+END_SRC being in lowercase and that didn't change anything.
>>
>
> Cannot reproduce either problem: the code block produces a
>
> #+RESULTS:
> : 3
>
> and the tangle says:
>
> tangled 1 code block from mark-stoehr.org
>
> Nick
>
> Version info:
>
> Org-mode version 7.8.11 (release_7.8.11-260-ga15b7d @ /home/nick/elisp/org-mode/lisp/)
> (includes a few local commits)
>
> GNU Emacs 24.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-07-28
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 19:11   ` Mark Stoehr
@ 2012-08-01 19:48     ` Thomas S. Dye
  2012-08-01 22:27     ` Rasmus
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas S. Dye @ 2012-08-01 19:48 UTC (permalink / raw)
  To: Mark Stoehr; +Cc: emacs-orgmode

Hi Mark,

Perhaps someone else can reproduce the problem then?  I'm not able to
reproduce it.  

If not, then one of the elisp wizards on this list might be able to
point out likely problems with your setup.

All the best,
Tom
  
Mark Stoehr <stoehr@cs.uchicago.edu> writes:

> Thanks Tom,
>
> I do have
>
> (org-babel-do-load-languages
>  'org-babel-load-languages '((python . t)
> 			     (R . t)))
>
> in my ~/.emacs.d/init.el
>
> and my version (from M-x org-version) is
> Org-mode version 7.8.11
>
> Cheers,
> Mark
>
> On Wed, Aug 1, 2012 at 2:07 PM, Thomas S. Dye <tsd@tsdye.com> wrote:
>> Aloha Mark,
>>
>> Mark Stoehr <stoehr@cs.uchicago.edu> writes:
>>
>>> Hi,  I'm trying to include python source code in my document and I'm
>>> finding that org-babel-execute-buffer ( as well as C-c C-c at the end
>>> of a code block) does not successfully run my code, instead I get an
>>> error "Invalid function: org-save-outline-visibility".  I saw messages
>>> earlier
>>>
>>> http://thread.gmane.org/gmane.emacs.orgmode/28048/focus=28049
>>>
>>> regarding an apparently similar problem but my understanding of emacs
>>> lisp is insufficient for me to make sense of it.  My program:
>>>
>>> #+BEGIN_SRC python
>>> print "Hello World"
>>> return 1+2
>>> #+END_SRC
>>>
>>>
>>> I also have trouble getting tangle to work. With the following problem
>>>
>>>
>>> #+BEGIN_SRC python :tangle yes
>>> print "Hello World"
>>> return 1+2
>>> #+END_SRC
>>>
>>> both C-c C-v t and M-x org-babel-tangle fail saying that 0 blocks have
>>> been tangled.  I also tried the examples with the #+BEGIN_SRC and
>>> #+END_SRC being in lowercase and that didn't change anything.
>>>
>>>
>>
>> Your source code block evaluates fine on my setup:
>>
>> #+BEGIN_SRC python
>> print "Hello World"
>> return 1+2
>> #+END_SRC
>>
>> #+RESULTS:
>> : 3
>>
>> The error message you are getting refers to a bug that was apparently
>> fixed some time ago.  What version of Org mode are you running?
>>
>> Also, did you tell Org mode that you will be evaluating Python code?
>> You should have something like this in .emacs:
>>
>>   (org-babel-do-load-languages
>>    'org-babel-load-languages
>>    '((R . t)
>>      (C . t)
>>      (ditaa . t)
>>      (dot . t)
>>      (emacs-lisp . t)
>>      (gnuplot . nil)
>>      (haskell . nil)
>>      (latex . t)
>>      (lisp . t)
>>      (ocaml . nil)
>>      (org . t)
>>      (perl . t)
>>      (python . t)  # This is the line you'll need
>>      (ruby . nil)
>>      (screen . nil)
>>      (sh . t)
>>      (sql . nil)
>>      (sqlite . t)))
>>
>> hth,
>> Tom
>>
>> --
>> Thomas S. Dye
>> http://www.tsdye.com
>>

-- 
T.S. Dye & Colleagues, Archaeologists
735 Bishop St, Suite 315, Honolulu, HI 96813
Tel: 808-529-0866, Fax: 808-529-0884
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 19:18   ` Mark Stoehr
@ 2012-08-01 19:58     ` Eric Schulte
  2012-08-01 20:00     ` Nick Dokos
  1 sibling, 0 replies; 9+ messages in thread
From: Eric Schulte @ 2012-08-01 19:58 UTC (permalink / raw)
  To: Mark Stoehr; +Cc: nicholas.dokos, emacs-orgmode

Mark Stoehr <stoehr@cs.uchicago.edu> writes:

> I just installed emacs and org-mode on a new machine, do you have any
> suggestions for debugging this?
>

Hi Mark,

What version of Org-mode do you have installed?

What version of Emacs are you using?

Does the problem persist when you start emacs with "emacs -Q"?

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 19:18   ` Mark Stoehr
  2012-08-01 19:58     ` Eric Schulte
@ 2012-08-01 20:00     ` Nick Dokos
  1 sibling, 0 replies; 9+ messages in thread
From: Nick Dokos @ 2012-08-01 20:00 UTC (permalink / raw)
  To: Mark Stoehr; +Cc: emacs-orgmode

Mark Stoehr <stoehr@cs.uchicago.edu> wrote:

> I just installed emacs and org-mode on a new machine, do you have any
> suggestions for debugging this?
> 

No easy way, I'm afraid (but maybe somebody else can think of something
better). I usually run edebug on the suspect function and single step
through it, examining variables as I go.

For details on edebug, see the emacs lisp manual, section 18.2 "Edebug".

Nick

> Mark
> 
> On Wed, Aug 1, 2012 at 2:11 PM, Nick Dokos <nicholas.dokos@hp.com> wrote:
> > Mark Stoehr <stoehr@cs.uchicago.edu> wrote:
> >
> >> Hi,  I'm trying to include python source code in my document and I'm
> >> finding that org-babel-execute-buffer ( as well as C-c C-c at the end
> >> of a code block) does not successfully run my code, instead I get an
> >> error "Invalid function: org-save-outline-visibility".  I saw messages
> >> earlier
> >>
> >> http://thread.gmane.org/gmane.emacs.orgmode/28048/focus=28049
> >>
> >> regarding an apparently similar problem but my understanding of emacs
> >> lisp is insufficient for me to make sense of it.  My program:
> >>
> >> #+BEGIN_SRC python
> >> print "Hello World"
> >> return 1+2
> >> #+END_SRC
> >>
> >>
> >> I also have trouble getting tangle to work. With the following problem
> >>
> >>
> >> #+BEGIN_SRC python :tangle yes
> >> print "Hello World"
> >> return 1+2
> >> #+END_SRC
> >>
> >> both C-c C-v t and M-x org-babel-tangle fail saying that 0 blocks have
> >> been tangled.  I also tried the examples with the #+BEGIN_SRC and
> >> #+END_SRC being in lowercase and that didn't change anything.
> >>
> >
> > Cannot reproduce either problem: the code block produces a
> >
> > #+RESULTS:
> > : 3
> >
> > and the tangle says:
> >
> > tangled 1 code block from mark-stoehr.org
> >
> > Nick
> >
> > Version info:
> >
> > Org-mode version 7.8.11 (release_7.8.11-260-ga15b7d @ /home/nick/elisp/org-mode/lisp/)
> > (includes a few local commits)
> >
> > GNU Emacs 24.1.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.4) of 2012-07-28
> >
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Getting source code to work
  2012-08-01 19:11   ` Mark Stoehr
  2012-08-01 19:48     ` Thomas S. Dye
@ 2012-08-01 22:27     ` Rasmus
  1 sibling, 0 replies; 9+ messages in thread
From: Rasmus @ 2012-08-01 22:27 UTC (permalink / raw)
  To: emacs-orgmode

Mark Stoehr <stoehr@cs.uchicago.edu> writes:

> and my version (from M-x org-version) is
> Org-mode version 7.8.11

How about 

sh> python --version

On my system where python is 3.2.3 and python2 is 2.7.3 I have

   (setq org-babel-python-command "python2") 

–Rasmus  

-- 
Hooray!

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-08-01 22:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-01 18:51 Getting source code to work Mark Stoehr
2012-08-01 19:07 ` Thomas S. Dye
2012-08-01 19:11   ` Mark Stoehr
2012-08-01 19:48     ` Thomas S. Dye
2012-08-01 22:27     ` Rasmus
2012-08-01 19:11 ` Nick Dokos
2012-08-01 19:18   ` Mark Stoehr
2012-08-01 19:58     ` Eric Schulte
2012-08-01 20:00     ` Nick Dokos

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).