问题
Tableau recently expanded some tools for developers to Linux, from Windows-only. After downloading the Tableau Data Extract API libraries for Python (2.7) on Linux (64Bit, version 8.1), I extracted the files and installed the libraries using the standard 'python setup.py install'
When trying to run with a code that works on Windows, I get the following error:
Traceback (most recent call last):
File "apache.py", line 280, in <module>
print create_tableau(tsvfile)
File "apache.py", line 136, in create_tableau
import dataextract as tde
File "/usr/local/lib/python2.7/dist-packages/dataextract/__init__.py", line 15, in <module>
from Base import *
File "/usr/local/lib/python2.7/dist-packages/dataextract/Base.py", line 17, in <module>
from . import StringUtils
File "/usr/local/lib/python2.7/dist-packages/dataextract/StringUtils.py", line 17, in <module>
tablib = libs.load_lib
File "/usr/local/lib/python2.7/dist-packages/dataextract/Libs.py", line 35, in load_lib
self.lib = ctypes.cdll.LoadLibrary(self.lib_path)
File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/local/lib/python2.7/dist-packages/dataextract/lib/../lib/libicuio.so.50: file too short
How can I fix this 'file too short' error?
回答1:
There is an error when copying or extracting the libraries, where the links are actually files. A similar example is here.
You need to remove the files that are supposed to be links, and then re-link them.
cd /usr/local/lib/python2.7/dist-packages/dataextract/lib/../lib/
rm libicudata.so.50 && ln -s libicudata.so.50.1.2 libicudata.so.50
rm libicui18n.so.50 && ln -s libicui18n.so.50.1.2 libicui18n.so.50
rm libicuio.so.50 && ln -s libicuio.so.50.1.2 libicuio.so.50
rm libicule.so.50 && ln -s libicule.so.50.1.2 libicule.so.50
rm libiculx.so.50 && ln -s libiculx.so.50.1.2 libiculx.so.50
rm libicutu.so.50 && ln -s libicutu.so.50.1.2 libicutu.so.50
rm libicuuc.so.50 && ln -s libicuuc.so.50.1.2 libicuuc.so.50
来源:https://stackoverflow.com/questions/22247734/file-too-short-with-tableau-data-extract-api-python-and-linux