Julia print commands not working in emacs org-mode


Dear All,

I am trying to run julia in emacs org-mode by following the instructions at https://github.com/JuliaEditorSupport/julia-emacs. Everything seems to be working except print commands.

If I have the following source block:

#+BEGIN_SRC julia

Then I get the following error:

ERROR: MethodError: no method matching start(::Void)
Closest candidates are:
  start(!Matched::SimpleVector) at essentials.jl:258
  start(!Matched::Base.MethodList) at reflection.jl:560
  start(!Matched::ExponentialBackOff) at error.jl:107
 [1] #writedlm#18(::Array{Any,1}, ::Function, ::IOStream, ::Void, ::Char) at ./datafmt.jl:673
 [2] #20 at ./datafmt.jl:683 [inlined]
 [3] open(::Base.DataFmt.##20#21{Array{Any,1},Void,Char}, ::String, ::String) at ./iostream.jl:152
 [4] #writecsv#23(::Array{Any,1}, ::Function, ::String, ::Void) at ./datafmt.jl:705
 [5] writecsv(::String, ::Void) at ./datafmt.jl:705

I am using emacs 25.3.2 on ubuntu 16.04, julia 0.6. I will appreciate any help. If I take away commands associated with print or println, everything works.

I will appreciate any suggestion.

Best Regards,


I am trying to reproduce. I have julia-mode installed, but when I put the code in an orgmode file and press C-c C-c, I get the error No org-babel-execute function for julia!. Did you find this in a separate package, perhaps ob-julia?


Thanks for your response.

I did the following. After installing julia-mode I enabled Julia in the init file:

(add-to-list 'load-path "path_to_where_julia-mode.el_file_is_located")
(require 'julia-mode)
(setq inferior-julia-program-name "path_to_where_julia_is_located/julia")

Now in the init file I found the part which looks like the following:

 '((emacs-lisp . t)

and added the line

(julia . t)

somewhere in the list of enabled languages. Let me know if that gets rid of the issue.



I was able to reproduce the issue.

But it works for me if I modify the first line to say #+BEGIN_SRC julia :results output.

The default setting is :results value.

EDIT: This, of course, does not fully explain why your code fails, but it is a step toward understanding what the underlying issue is…


OK, it turns out that for :results value the following code is actually what is being executed if you study ob-julia.el:

writecsv("/tmp/babel-2072Vgu/julia-2072RSg", begin

The return value of print, which is nothing, is passed to writecsv which thus fails. And everything written to STDOUT is ignored as far as babel is concerned.

EDIT: See here for an explanation of why writecsv is called. I am not convinced this is the optimal function to call; really there should be a function (I think) that takes any julia value and writes it in the format orgmode expects, without using csv as an intermediary…


See also: https://github.com/gjkerns/ob-julia/issues/2


I see. Okay, I guess I will just use

:results output

for now when I need to have a print statement.

Many Thanks,