Zim-desktop-wiki: can't run zim in mac getting "Can not import 'xdg.Mime' "

Created on 29 Aug 2017  ·  6Comments  ·  Source: zim-desktop-wiki/zim-desktop-wiki

I tired running zim in my Mac Sierra 10.12.3 but I get this error WARNING: Can not import 'xdg.Mime' - falling back to 'mimetypes'

needs info

Most helpful comment

I ended up having this problem too.

This is what I did that fixed it.

  1. Install prerequisites from Install page of the zim website

    • brew install gtk-mac-integration
    • /usr/local/bin/pip install pyxdg
  2. Install and link Python 2.7.14 from Homebrew.

  3. With the new repo I ran
    /usr/local/Cellar/python/2.7.14_3/bin/python2.7 setup.py build
    /usr/local/Cellar/python/2.7.14_3/bin/python2.7 zim.py

After that, it ran perfectly.
What I think is the issue is the system python is 2.6 which for some reason doesn't support "gobject", xgd.Mine, and the Python 3 way of print statements.

Extra Info:
Zim Version: 0.68-rc1
Python version: 2.7.14_3 (linked and installed from Homebrew)
Homebrew version: 1.5.3
macOS version: High Sierra 10.13.3

I hope this helps!

All 6 comments

This _warning_ should not prevent you from running zim, so if you can't run it, there must be something else going wrong.

I ended up having this problem too.

This is what I did that fixed it.

  1. Install prerequisites from Install page of the zim website

    • brew install gtk-mac-integration
    • /usr/local/bin/pip install pyxdg
  2. Install and link Python 2.7.14 from Homebrew.

  3. With the new repo I ran
    /usr/local/Cellar/python/2.7.14_3/bin/python2.7 setup.py build
    /usr/local/Cellar/python/2.7.14_3/bin/python2.7 zim.py

After that, it ran perfectly.
What I think is the issue is the system python is 2.6 which for some reason doesn't support "gobject", xgd.Mine, and the Python 3 way of print statements.

Extra Info:
Zim Version: 0.68-rc1
Python version: 2.7.14_3 (linked and installed from Homebrew)
Homebrew version: 1.5.3
macOS version: High Sierra 10.13.3

I hope this helps!

Thank you @jansenfuller this works for me.
And in step 3: $ python2 zim.py would work fine;
In case symbolic links doesn't created correctly: $ brew unlink python && brew link python
And check again: $ ls -l `which python2`

I'm seeing this now with the master branch with Python 3.7.2 installed via Homebrew.

~/Development/Personal/zim-desktop-wiki (master ✔) ᐅ python3.7 setup.py build           
Can not import 'xdg.Mime' - falling back to 'mimetypes'
Can not import 'xdg.Mime' - falling back to 'mimetypes'
Traceback (most recent call last):
  File "setup.py", line 22, in <module>
    from zim import __version__, __url__
  File "/Users/iweiss/Development/Personal/zim-desktop-wiki/zim/__init__.py", line 195, in <module>
    import zim.config
  File "/Users/iweiss/Development/Personal/zim-desktop-wiki/zim/config/__init__.py", line 10, in <module>
    from .dicts import *
  File "/Users/iweiss/Development/Personal/zim-desktop-wiki/zim/config/dicts.py", line 35, in <module>
    from zim.utils import OrderedDict
ImportError: bad magic number in 'zim.utils': b'\x03\xf3\r\n'

@lasombra the warning about "xdg.Mime" is not the reason of the failure - it is just a message before the acutal failure.

In your case the failure is probably because python3 is trying to access files used by python2. Running "make clean" or just removing all "*.pyc" files in the tree should help. Or just delete the source and do a fresh checkout before running python3.

Closing as this is not an error - or not the real error at least

Was this page helpful?
0 / 5 - 0 ratings

Related issues

CharlesNepote picture CharlesNepote  ·  6Comments

neokeld picture neokeld  ·  6Comments

jaap-karssenberg picture jaap-karssenberg  ·  6Comments

jaap-karssenberg picture jaap-karssenberg  ·  8Comments

Nick222 picture Nick222  ·  4Comments