← Back to team overview

zim-wiki team mailing list archive

Re: Zim export: RuntimeError: could not open display

 

Hi Robert,

Afraid I still did not clean the code to run without an display.

If you know some python, modify the file mentioned in the error and add a
"try .. except .." block to catch this error. Very likely you will find one
or more similar errors before it runs without a terminal.

If you do get it to work, please submit your changes so I can patch the dev
trunk.

Regards,

Jaap




On Sat, Feb 22, 2014 at 7:58 PM, Robert Harker
<harker-launchpas@xxxxxxxxxx>wrote:

> I am trying to write a cron script that pulls the current version of a zim
> notebook from git and then generates (exports) the HTML pages in
> /var/www/html to be served up by httpd.
>
> I have a simple script:
>   #!/bin/sh
>   SRC=/home/example/Notebook
>   DEST=/var/www/html/Notebook
>   # do a git pull to update notebook
>   (cd $SRC; git pull -q origin)
>   # do a zim export to generate static web pages
>   zim --export --format=html --index-page=index.html \
>     --root-url=http://example.com/Notebook/ \
>     --output=$DEST $SRC
>
> If I log in to my remote server with the -Y flag to enable a remote X
> display:
>   ssh -Y harker.com
> And run the command manually, everything works
>
> But if I try and run the script via cron or if I just do a simple ssh
> without the -Y flag I get the error:
>   RuntimeError: could not open display
>
> Is there a work around for this?
>
> Thanks
> RLH
>
> Complete python error:
> zim --export --format=html --output=/var/www/html/Notebook ~/Notebook/
> Traceback (most recent call last):
>   File "/usr/bin/zim", line 74, in <module>
>     zim.main(argv)
>   File "/usr/lib/python2.6/site-packages/zim/__init__.py", line 391, in
> main
>     handler = NotebookInterface(notebook=args[0])
>   File "/usr/lib/python2.6/site-packages/zim/__init__.py", line 575, in
> __init__
>     self.load_early_plugins()
>   File "/usr/lib/python2.6/site-packages/zim/__init__.py", line 584, in
> load_early_plugins
>     import zim.plugins
>   File "/usr/lib/python2.6/site-packages/zim/plugins/__init__.py", line
> 36, in <module>
>     from zim.actions import action, toggle_action, get_actiongroup
>   File "/usr/lib/python2.6/site-packages/zim/actions.py", line 26, in
> <module>
>     import gtk
>   File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
> 64, in <module>
>     _init()
>   File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line
> 52, in _init
>     _gtk.init_check()
> RuntimeError: could not open display
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~zim-wiki
> Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~zim-wiki
> More help   : https://help.launchpad.net/ListHelp
>

References