[python-win32] Having ODBC and Excel problems with Python2.3.4/PyWin 201.1 on Windows Xp

Mark Hammond mhammond at skippinet.com.au
Thu Jun 17 19:11:30 EDT 2004


> Until this week I have been using Python 2.3.3 and
> win32all build 163 on a Windows XP machine to connect
> to a Sybase server using Sybase 11 ODBC and process
> and place the results into Excel 2002 worksheets.  The
> only problem I encountered was that Python longs
> between 2**31 and 2**32 were interpreted as signed
> integers when I placed them into Excel and displayed
> as negative values.  I just converted them to floats
> and they displayed correctly.

This should be fixed in the next build (I only just discovered that myself)

> First excel. Using PyWin 201.1, if I write a second
> range onto a worksheet, I get an access error and
> Python abends with an uncaught exception.  Moving back
> to build 200 seems to fix this problem.

Can you please send me an example of this?

> Then ODBC.  In some python programs, if I use
> parameterized selects in 201.1, the ODBC module
> complains that there is a missing column in an insert.
>  If I perform the substitution before calling ODBC
> with the cursor, it works fine.  I tried using an
> explicit tuple conversion instead of the , style, and
> the calls worked as well.  e.g. curs.execute (query,
> tuple (subval))
> instead of curs.execute (query, (subval,))  In other
> programs the ODBC code that worked under 2.3.3 and
> build 163 worked flawlessly in build 200 and 201.1.
>
> Am I doing something wrong or are these known problems
> under later builds of Python and Pywin?  I'll probably
> just go back to the earlier win32all build 163 if
> these are known problems with no workarounds.
>
> I looked at the ODBC.cpp module, and as near as I
> could figure, everything looked OK. Is it possible
> that these are problems with my Windows XP
> configuration?  I'm not very familiar with the Windows
> programming API.

I'm afraid these aren't known problems.  I would be quite surprised about
ODBC - between build 200 and 201, there was a single change:

revision 1.10
date: 2004/04/25 04:31:41;  author: mhammond;  state: Exp;  lines: +0 -1
Remove apparently unnecessary lowercase of the column names, as requested
in [ 937779 ] ODBC-Metadata.

diff -r1.9 -r1.10
1029d1028
<               _strlwr(name);

It seems unlikely this is the problem - it was only lowercasing the name
returned to you in the result tuple, not the case of the name passed to the
driver itself.  But anything is possible.  If you would like to be sure, I
could build a 2.3 version of ODBC before that change and see if your problem
goes away.  A quick look at bug 937779 probably wouldn't hurt too.

Mark




More information about the Python-win32 mailing list