Menu

#38 Mac OSX Import Error

open
nobody
None
5
2011-10-17
2011-10-17
qoda
No

I'm trying to install python-sybase on OSX Lion (FreeTDS 0.82). These are the steps I took:

$ sudo python setup.py build_ext -D HAVE_FREETDS -U WANT_BULKCOPY (Successful)
$ python setup.py install (Successful)

But as soon as I try and import the lib, this is want I get. Please could someone help.

Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Sybase
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/python_sybase-0.40pre1-py2.7-macosx-10.6-intel.egg/sybasect.py:3: UserWarning: Module sybasect was already imported from /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/python_sybase-0.40pre1-py2.7-macosx-10.6-intel.egg/sybasect.pyc, but /Users/jonathan/Downloads/python-sybase-0.40pre1 is being added to sys.path
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "Sybase.py", line 15, in <module>
from sybasect import *
File "build/bdist.macosx-10.6-intel/egg/sybasect.py", line 7, in <module>
File "build/bdist.macosx-10.6-intel/egg/sybasect.py", line 6, in __bootstrap__
ImportError: dlopen(/Users/jonathan/.python-eggs/python_sybase-0.40pre1-py2.7-macosx-10.6-intel.egg-tmp/sybasect.so, 2): Symbol not found: _blk_bind
Referenced from: /Users/jonathan/.python-eggs/python_sybase-0.40pre1-py2.7-macosx-10.6-intel.egg-tmp/sybasect.so
Expected in: flat namespace
in /Users/jonathan/.python-eggs/python_sybase-0.40pre1-py2.7-macosx-10.6-intel.egg-tmp/sybasect.so

Discussion

  • qoda

    qoda - 2011-10-17

    I've managed to fix by doing the below. It seems the env_vars where incorrect.

    INSTALL FREETDS
    ---------------------------
    $ sudo port install freetds
    $ vim /opt/local/freetds/freetds.conf

    [SERVER]
    host = sybase.server.co.za
    port = 5000
    tds version = 5.0

    SETUP ENV VARS
    --------------------------
    $ sudo vim /etc/profile

    SYBASE=/opt/local/
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib
    export SYBASE LD_LIBRARY_PATH

    DOWNLOAD AND INSTALL PYTHON-SYBASE
    ----------------------------------------------------------------
    $ wget http://downloads.sourceforge.net/python-sybase/python-sybase-0.40pre1.tar.gz
    $ tar -xf python-sybase-0.40pre1.tar.gz
    $ cd python-sybase-0.40pre1/
    $ python setup.py build_ext -D HAVE_FREETDS
    $ python setup.py install

    TEST INSTALL
    ---------------------
    $ python -m Sybase

     
  • Robert Boehne

    Robert Boehne - 2011-12-05

    I would guess that the sybase (or freetds) libraries are not being linked to sybasect.so,
    Can you please reproduce this result with svn trunk? It should be a relatively easy fix if the problem is still there.

     

Log in to post a comment.