Running PDFNet for Python on Linux

Q:

I am running the example WebViewerConvert in python 2.7 on a 64-bit architecture ( Debian GNU/Linux 6.0 x86_64
) raises this error:

./RunTest.sh
Traceback (most recent call last):
File “WebViewerConvert.py”, line 11, in
from PDFNetPython2 import *
File “/opt/PDFNetC64/Lib/PDFNetPython2.py”, line 26, in
_PDFNetPython2 = swig_import_helper()
File “/opt/PDFNetC64/Lib/PDFNetPython2.py”, line 22, in swig_import_helper
_mod = imp.load_module(’_PDFNetPython2’, fp, pathname, description)
ImportError: /opt/PDFNetC64/Lib/_PDFNetPython2.so: undefined symbol: PyCapsule_GetPointer

I have checked more than once that I’m using the binaries distributed PDFNetC64.tar.gz in What may be happening?

A:

Python2 wrapper comes with _PDFNetPython2_ucs4.so to use PDFNetC with Python interpreters that are built with 4-byte Unicode. To use this wrapper, rename _PDFNetPython2_ucs4.so to _PDFNetPython2.so and replace the original file.

To check the width of Unicode used on your system:

When built with --enable-unicode=ucs4:

>>> import sys
>>> print sys.maxunicode
1114111
 

When built with --enable-unicode=ucs2:

>>> import sys
>>> print sys.maxunicode
65535

FYI: The Python version is the problem, the production server is running with 2.6.6 I tested locally with Python 2.7.3 and it works perfect.