← Back to team overview

zim-wiki team mailing list archive

Re: Diagram Editor not working on Windows 7


On Thu, Apr 11, 2013 at 10:04 AM, Bagana Khereid <bagana@xxxxxxxxxx> wrote:

> I'm new to this mailing list. Found it from Zim homepage following
> "For user questions and development discussion, please join the
> mailing list...", Hope this is the right place for this mail.

Feel free to ask here. To report specific issues that need fixes in zim,
please use the bug tracker at https://bugs.launchpad.net/zim

I've been using *Zim 0.59* on a *Windows 7 64bit* machine for a while
> now, but only with a few pre-installed plugins enabled. When I wanted
> to draw some block diagrams in my wiki's a couple days ago, I
> downloaded *GraphViz 2.30.1* (with its *bin* directory added in my
> PATH variable) along with *Pango 1.29.4-1* and enabled *Diagram
> Editor* plugin in Zim Preferences view. But the plugin didn't work.
>     1. In "Insert Diagram" dialogue, an error icon is displayed in the
> preview area when I click on the "Preview" button. When I click on the
> "OK" button, it says "An error occurred while generating the image. Do
> you want to save the source text anyway?".
>     2. I confirmed that the "dot" command from GraphViz is working as
> expected when I type it in a command line interface (both cmd.exe and
> MSYS shell are tested).
>     3. Following is a piece of GraphViz code I tested with:
>                 digraph G {
>                         foo -> bar
>                 }
>     4. I googled around and got nothing useful.
> So I'm wondering,
>     1. Did anyone see this problem before?

Just tested using source version of zim on windows 7 with Graphviz 2.21
installed. Works as expected.

Not tested:
- compiled version of zim
- GraphViz 2.30

>     2. I can't find a log file anywhere, is there one? Or is there a
> switch to enable/disable logging?

The logging from zim can be found in "%TM%/zim.log", to get detailed debug
output use "zim -D --standalone". The log will include a line where the
"dot" command is executed, but not output from the dot command. Please
check this log for any bugs in zim itself (before calling dot).

>     3. In .../zim-0.59/App/ZimDesktopWiki/zim/plugins/diagrameditor.py,
> line 107, I found:
>                 # Call GraphViz
>                 try:
>                         dot = Application(dotcmd)
>                         dot.run((self.pngfile, self.dotfile))
>                 except ApplicationError:
>                         return None, None # Sorry, no log
>                 else:
>                         return self.pngfile, None
> Is that "except" clause the right place to trace down the problem? (I
> don't know Python, sorry!)

Well, yes, but you don't have much info at that point since the dot command
does not generate a log. You can add a statement before "return None, None"

    except ApplicationError:
         import logging
         logger = logging.getLogger('zim.plugins.diagrameditor')
         logger.exception('Error running dot:')
         return None, None # Sorry, no log

This will add any information that can be obtained to the log. But might
not be very informative.

(be aware that python is sensitive to indenting level, so put is at the
proper depth)

I found that every ".py" file in that directory has a ".pyo" version,
> they seem to be "compiled" Python modules?

Yes, but don't worry, they are regenerated when the source is edited - no
need to compile anything yourself.

> I don't have a Python compiler/runtime. If this is not a known issue
> or there's not a known solution for it, I'm gonna install one and
> start to learn some Python. I really love Zim for its simplicity and
> extensibility and its file system hierarchy for storage.

Actually you have :) it is compiled in the zim executable you have .. but
separate version is indeed easier for debugging.



Follow ups