Bear with me, this is CentOS related. :)
I have a python CGI that's behaving weirldy on Whitebox systems that've been switched over to CentOS 4 (ages ago, no other problems to speak of aside from this one).
I've broken the problem down to a minimal test case...
1. Create a small database
# sqlite3 /tmp/testcase.db 'CREATE TABLE testtable ( date date primary key unique, name varchar(32));' # sqlite3 /tmp/testcase.db 'insert into "testtable" values("2006-10-10", "Will");' # sqlite3 /tmp/testcase.db 'insert into "testtable" values("2006-10-11", "Will");'
2. A small Python script to query this database:
#!/usr/bin/python
import sqlite
cx = sqlite.connect('/tmp/testcase.db') cu = cx.cursor() cu.execute("select date from %s where date like '%s' ;" % ('testtable', '2006-10-' + "%")) print cu.fetchall() ## -------------------- END SCRIPT -------------------- ##
Now, here's what's confusing me. If I run this on a box that was built from scratch with CentOS I get the following data back...
[root@willspc python]# ./testcase.py [('2006-10-10',), ('2006-10-11',)]
If I run it on any upgraded Whitebox system I get...
[root@devmon1 python]# ./testcase.py [(<DateTime object for '2006-10-10 00:00:00.00' at b7f14138>,), (<DateTime object for '2006-10-11 00:00:00.00' at b7cbfdb0>,)]
As far as I can tell, python, sqlite and python-sqlite are all identical.
[root@willspc python]# rpm -qa | grep -Ei '(sqlite)|(python)' | sort libxml2-python-2.6.16-6 mod_python-3.1.3-5.1 python-2.3.4-14.2 python-elementtree-1.2.6-4.2.1 python-sqlite-1.1.7-1.2 python-urlgrabber-2.9.8-2 rpm-python-4.3.3-18_nonptl sqlite-3.3.3-1.2
On the upgraded system...
[root@devmon1 python]# rpm -qa | grep -Ei '(sqlite)|(python)' | sort libxml2-python-2.6.16-6 mod_python-3.1.3-5.1 MySQL-python-1.0.0-1.RHEL4.1 python-2.3.4-14.2 python-clearsilver-0.10.1-1.2.el4.rf python-elementtree-1.2.6-7.el4.rf python-sqlite-1.1.7-1.2 python-urlgrabber-2.9.8-2 rpm-python-4.3.3-18_nonptl sqlite-3.3.3-1.2 sqlite-devel-3.3.3-1.2
Obviously there some date/time issues but I can't pinpoint exactly what. Can anyone shed any light or prod me in the right direction? The Whitebox systems *do* still have a smattering of Whitebox related RPMs...
[root@devmon1 python]# rpm -qa | grep white rpmdb-whitebox-4-0.20050504 whitebox-logos-1.1.25-1.WB1
That system did have whitebox-lsb installed too but I've rpm -e'd it and replaced redhat-lsb, haven't rebooted yet but that's next on the agenda.
Cheers.
Will.
On Tue, Oct 10, 2006 at 03:59:42PM +0100, Will McDonald wrote:
Bear with me, this is CentOS related. :)
[...]
As far as I can tell, python, sqlite and python-sqlite are all identical.
[root@willspc python]# rpm -qa | grep -Ei '(sqlite)|(python)' | sort libxml2-python-2.6.16-6 mod_python-3.1.3-5.1 python-2.3.4-14.2 python-elementtree-1.2.6-4.2.1 python-sqlite-1.1.7-1.2 python-urlgrabber-2.9.8-2 rpm-python-4.3.3-18_nonptl sqlite-3.3.3-1.2
On the upgraded system...
[root@devmon1 python]# rpm -qa | grep -Ei '(sqlite)|(python)' | sort libxml2-python-2.6.16-6 mod_python-3.1.3-5.1 MySQL-python-1.0.0-1.RHEL4.1 python-2.3.4-14.2 python-clearsilver-0.10.1-1.2.el4.rf python-elementtree-1.2.6-7.el4.rf python-sqlite-1.1.7-1.2 python-urlgrabber-2.9.8-2 rpm-python-4.3.3-18_nonptl sqlite-3.3.3-1.2 sqlite-devel-3.3.3-1.2
Obviously there some date/time issues but I can't pinpoint exactly what. Can anyone shed any light or prod me in the right direction? The Whitebox systems *do* still have a smattering of Whitebox related RPMs...
what about mx? this rpm provides python modules which do date/time type conversion (and more), yet you haven't listed it above. perhaps its installed on one machine, but not the other?
on my centos 4 machine: $ rpm -q mx mx-2.0.5-3
Cheers, Bryan Cardillo Penn Bioinformatics Core University of Pennsylvania
On 10/10/06, Bryan Cardillo dillo@pcbi.upenn.edu wrote:
On Tue, Oct 10, 2006 at 03:59:42PM +0100, Will McDonald wrote:
Bear with me, this is CentOS related. :)
[...]
As far as I can tell, python, sqlite and python-sqlite are all identical.
Obviously there some date/time issues but I can't pinpoint exactly what. Can anyone shed any light or prod me in the right direction? The Whitebox systems *do* still have a smattering of Whitebox related RPMs...
what about mx? this rpm provides python modules which do date/time type conversion (and more), yet you haven't listed it above. perhaps its installed on one machine, but not the other? on my centos 4 machine: $ rpm -q mx mx-2.0.5-3
Bingo! Cheers dude.
I was just trawling through strace output. On the functioning machine (or at least, the one on which the code behaves as I expected) mx isn't installed, on the others it is.
"Working" system:
[root@willspc python]# strace ./testcase.py 2>&1 | wc -l 1033 [root@willspc python]# rpm -q mx package mx is not installed
"Broken" system:
[root@devmon1 python]# strace ./testcase.py 2>&1 | wc -l 1475 [root@devmon1 python]# rpm -q mx mx-2.0.5-3 [root@devmon1 python]#
And a lot of those divergences appeared to be mx related though I hadn't put 2 & 2 together until now.
On another previously "broken" system, after the removal of mx and python-MySQL
[root@stella python]# rpm -e mx MySQL-python [root@stella python]# ./testcase.py [('2006-10-10',), ('2006-10-11',)]
I guess it's upstream but it might be useful if that package was named python-mx, though it could equally be argued that I should've just done
$ rpm -q --whatrequires python
Anyway, that lets me know what the differences are, and I can either code to take it into account, or just require/remove mx as necessary. Thanks Bryan.
Will.