ncraun / smoothscan

smoothscan is a tool to convert scanned text into a vectorized output form.
GNU General Public License v3.0
67 stars 4 forks source link

ImportError: No module named 'fontforge' #3

Closed ncraun closed 11 years ago

ncraun commented 11 years ago

Split from arthurtiteica's original issue report:

With python3 the problem goes as

Traceback (most recent call last):
  File "/usr/bin/smoothscan-fontgen.py", line 23, in <module>
    import fontforge
ImportError: No module named 'fontforge'

I'm using python 3.3.2-2 fontforge 20120731_b-6 libharu 2.2.1-4 potrace 1.11-1 leptonica 1.69-8

ncraun commented 11 years ago

This error is commonly caused when using a version of fontforge which was compiled without python support. Smoothscan uses the python interface to call fontforge and generate the fonts, so if fontforge is compiled without python support, smoothscan won't work. There are some prebuilt versions of fontforge online that were compiled without python support, so if you are seeing this issue double check that your copy was built with python support, and if not rebuild it with python support. For more information on how to do this, check out this page: http://fontforge.org/python.html#extension

However, in this specific case the problem was with python 3. I was able to find this bit of info from the fontforge developers: https://github.com/fontforge/fontforge/pull/109 indicating that you can compile fontforge to work with python 2 or python 3 but not both. Which one you use will depend on which version your copy of fontforge is built against.

zcater commented 11 years ago

I see. In this case I should use python2 then as fontforge is built with it.

Thanks for the input.

ncraun commented 11 years ago

I modified the configure script to check what version of python fontforge was built against, and generate the python interface script to use that same version. It will also produce an error if it detects that fontforge was built without python support.

SHA: 0fe04edf8d7465e38d7a17ba72dca1abf788db13

zcater commented 11 years ago

Thanks. I confirm it correctly detects python2 in my case.