[ale] Python -> mssql: Okay, now I know

Charles Shapiro hooterpincher at gmail.com
Thu Sep 9 15:57:40 EDT 2010


Trying to install pymssql on an ancient, antique version of linux ( RH
7.3, would you believe??).  I installed freeTDS and unix-ODBC as
required, installed python 2.4.6 from source ( the default python here
is 2.1, ugh!!) got the "setup.py" in the pymssql installer to work,
and  it compiled the thousand lines or so of C with no errors and
appeared to install them in the correct places.

But alas, when I tried to actually use the module, I got:

>>> import pymssql
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/share/home/cshapiro/python2.4.6/lib/python2.4/site-packages/pymssql.py",
line 30, in ?
    import _mssql
ValueError: bad marshal data


Much struggle, misery, and googling of random questions ensued.

Finally, I found the secret: the ${PYTHONPATH} had been set to a bunch
of python 2.1 library directories.  Once I unset that ( or, actually,
ran with the -E flag),
then it all worked.

python24 -E
Python 2.4.6 (#2, Sep  8 2010, 13:27:02)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-98)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymssql
>>>

So for the next poor slob who has to work on outdated software but
somehow show progress, check your environment variables when you
install new versions!

-- CHS


More information about the Ale mailing list