getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
56 stars 92 forks source link

[orgmode] cannot render the org file with orgmode plugin #124

Open shelper opened 8 years ago

shelper commented 8 years ago

i got the error as below

Scanning posts........done! . render_sources:../shelper.github.io/zh_cn/posts/test/index.org . render_sources:../shelper.github.io/posts/test/index.org . render_posts:timeline_changes . render_posts:cache/posts/test.zh_cn.html Cannot open load file: ox-html

TaskError - taskid:render_posts:cache/posts/test.zh_cn.html PythonAction Error Traceback (most recent call last): File "/Users/zyuan/develop/nikola/plugins/orgmode/orgmode.py", line 73, in compile_html subprocess.check_call(command) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/subprocess.py", line 561, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['emacs', '--batch', '-l', '/Users/zyuan/develop/nikola/plugins/orgmode/init.el', '--eval', '(nikola-html-export "/Users/zyuan/develop/nikola/posts/test.org" "/Users/zyuan/develop/nikola/cache/posts/test.zh_cn.html")']' returned non-zero exit status 255

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/doit/action.py", line 383, in execute returned_value = self.py_callable(_self.args, *_kwargs) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/nikola/post.py", line 485, in compile self.is_two_file), File "/Users/zyuan/develop/nikola/plugins/orgmode/orgmode.py", line 82, in compile_html source, e.returncode)) Exception: Cannot compile posts/test.org -- bad org-mode configuration (return code 255)

Kwpolska commented 8 years ago

Cannot open load file: ox-html

It seems you might be missing the html export engine… please consult emacs/org-mode documentation for details.

(cc @punchagan)

punchagan commented 8 years ago

You will need to have ox-html (which IIRC is only available in org-mode >= v8.x).

shelper commented 8 years ago

i am using org-mode 8.2.10, and there is ox-html.el.gz and ox-html.elc, but not ox-html.el does that mean the plugin can only use ox-html.el but not the byte compiled one?

i just experimented using the unzipped ox-html.el, and i got a different error:

Scanning posts..........done! . render_archive:output/zh_cn/2015/index.html . render_archive:output/2015/index.html . render_archive:output/zh_cn/archive.html . render_archive:output/archive.html . render_tags:output/zh_cn/categories/index.html . render_tags:output/categories/index.html . render_posts:timeline_changes . render_posts:cache/posts/test.zh_cn.html Wrong number of arguments: called-interactively-p, 1 ######################################## TaskError - taskid:render_posts:cache/posts/test.zh_cn.html PythonAction Error Traceback (most recent call last): File "/Users/zyuan/develop/nikola2/plugins/orgmode/orgmode.py", line 73, in compile_html subprocess.check_call(command) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/subprocess.py", line 561, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['emacs', '--batch', '-l', '/Users/zyuan/develop/nikola2/plugins/orgmode/init.el', '--eval', '(nikola-html-export "/Users/zyuan/develop/nikola2/posts/test.org" "/Users/zyuan/develop/nikola2/cache/posts/test.zh_cn.html")']' returned non-zero exit status 255

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/doit/action.py", line 383, in execute returned_value = self.py_callable(_self.args, *_kwargs) File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/nikola/post.py", line 485, in compile self.is_two_file), File "/Users/zyuan/develop/nikola2/plugins/orgmode/orgmode.py", line 82, in compile_html source, e.returncode)) Exception: Cannot compile posts/test.org -- bad org-mode configuration (return code 255)

shelper commented 8 years ago

I tracked down to the init.el in the plugin folder, and i think it is the below snippet cause the problem

;; Load additional configuration from conf.el (let ((conf (expand-file-name "conf.el" (file-name-directory load-file-name)))) (if (file-exists-p conf) (load-file conf)))

Debugger entered--Lisp error: (wrong-type-argument stringp nil) file-name-directory(nil) (expand-file-name "conf.el" (file-name-directory load-file-name)) (let ((conf (expand-file-name "conf.el" (file-name-directory load-file-name)))) (if (file-exists-p conf) (load-file conf))) eval((let ((conf (expand-file-name "conf.el" (file-name-directory load-file-name)))) (if (file-exists-p conf) (load-file conf))) nil) eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp nil nil) command-execute(eval-last-sexp)

punchagan commented 8 years ago

Both those problems look like different problems. Can you try commenting out the snippet to load conf.el and see if things work?

;; ;; Load additional configuration from conf.el
;; (let ((conf (expand-file-name "conf.el" (file-name-directory load-file-name))))
;;   (if (file-exists-p conf)
;;       (load-file conf)))
shelper commented 8 years ago

that is what i did , then i have another error: Debugger entered--Lisp error: (wrong-type-argument stringp nil) file-name-directory(nil) (expand-file-name "macros.org" (file-name-directory load-file-name)) (find-file (expand-file-name "macros.org" (file-name-directory load-file-name))) (set-buffer (find-file (expand-file-name "macros.org" (file-name-directory load-file-name)))) (save-current-buffer (set-buffer (find-file (expand-file-name "macros.org" (file-name-directory load-file-name)))) (org-macro--collect-macros)) (setq nikola-macro-templates (save-current-buffer (set-buffer (find-file (expand-file-name "macros.org" (file-name-directory load-file-name)))) (org-macro--collect-macros))) eval-buffer() ; Reading at buffer position 1240 call-interactively(eval-buffer nil nil) command-execute(eval-buffer)

i tried to comment that macro block and the line (org-macro-replace-all nikola-macro-templates) as well, after that, no error, but for any org file after build it I lose all the headers and cannot correctly deploy it...

punchagan commented 7 years ago

@shelper is this still a problem?

Does emacs start for you without errors when using the plugin's init.el? Try running the following, and get back with the errors, if any.

$ emacs -Q -q --debug-init -l plugins/orgmode/init.el 
imkerberos commented 7 years ago

@shelper I have this problem too. After investigated, I found that I aliased the "emacs" with "open /Application/Emacs.app" in ".bashrc" . Remove the alias command from shell environment and install a newest version emacs (brew install emacs) will resolve this issue.

shelper commented 7 years ago

it works for me now after update everything. one question though, i use both org mode and md files, and i wonder why org-mode needs its own highlighting theme file? why it cannot use the theme for the code block that md file uses?

i have to follow exactly the steps as described here to get the code block pygmentized and the pygmentation is different from the md files.

shelper commented 7 years ago

actually it still has the issue with my macbook, on windows eveything is fine, and i am using the same version of nikola orgmode, emacs, configuration, etc.

Scanning posts..........done!
.  render_posts:cache/posts/test.html
Cannot open load file: ox-html
########################################
TaskError - taskid:render_posts:cache/posts/test.html
PythonAction Error
Traceback (most recent call last):
  File "/Users/zyuan/shelper.github.io/plugins/orgmode/orgmode.py", line 73, in compile_html
    subprocess.check_call(command)
  File "/Users/zyuan/anaconda/lib/python3.5/subprocess.py", line 581, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['emacs', '--batch', '-l', '/Users/zyuan/shelper.github.io/plugins/orgmode/init.el', '--eval', '(nikola-html-export "/Users/zyuan/shelper.github.io/posts/test.org" "/Users/zyuan/shelper.github.io/cache/posts/test.html")']' returned non-zero exit status 255

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/zyuan/anaconda/lib/python3.5/site-packages/doit/action.py", line 383, in execute
    returned_value = self.py_callable(*self.args, **kwargs)
  File "/Users/zyuan/anaconda/lib/python3.5/site-packages/nikola/post.py", line 540, in compile
    lang)
  File "/Users/zyuan/anaconda/lib/python3.5/site-packages/nikola/plugin_categories.py", line 304, in compile
    self.compile_html(source, dest, is_two_file)
  File "/Users/zyuan/shelper.github.io/plugins/orgmode/orgmode.py", line 97, in compile_html
    source, e.returncode))
Exception: Cannot compile posts/test.org -- bad org-mode configuration (return code 255)
shelper commented 7 years ago

since the error is about ox-html, i put the ox-html.el into the load path and a new error says: "cannot load cl-lib file"

then i put cl-lib in the load path, the error does not go away.... dont know what to do...