From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 13 11:13:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 13 15:13:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 13 15:21:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 13 16:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:20 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 20:01:22 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 13 20:01:22 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 20:01:22 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 13 20:01:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 13 20:01:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 13 20:01:22 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 13 20:01:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:07 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 08:02:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 08:02:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 08:02:08 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 14 08:02:08 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 08:02:08 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 14 08:02:08 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 14 08:02:08 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 14 12:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 14 16:00:36 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 14 20:00:34 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 15 08:01:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 15 12:00:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:37 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 16:00:37 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 16:00:38 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 16:00:38 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 15 16:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 16:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 15 16:00:38 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 15 16:00:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 15 20:00:34 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:16 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 08:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 08:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 08:02:17 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 16 08:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 08:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 16 08:02:17 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 16 08:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 16 12:00:40 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 16 16:00:37 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 16 20:00:33 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:16 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 08:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 08:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 08:02:17 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 17 08:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 08:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 17 08:02:17 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 17 08:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 17 12:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 17 16:00:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 17 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 08:03:58 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 08:03:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 08:03:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 08:03:58 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 18 08:03:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 08:03:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 18 08:03:58 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 18 08:03:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 18 12:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 18 16:01:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 18 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 19 08:04:21 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 19 12:00:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 16:02:21 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 16:02:21 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 16:02:21 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 16:02:21 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 19 16:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 16:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 19 16:02:22 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 19 16:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 19 20:00:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 08:05:57 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 08:05:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 08:05:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 08:05:58 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 20 08:05:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 08:05:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 20 08:05:58 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 20 08:05:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 12:01:40 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 12:01:40 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 12:01:40 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 12:01:41 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 20 12:01:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 12:01:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 20 12:01:41 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 20 12:01:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 20 16:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 20 20:00:37 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 21 08:03:32 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 21 12:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 21 16:00:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 21 20:00:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 22 08:02:29 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 22 12:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 16:00:59 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 16:00:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 16:00:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 16:00:59 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 22 16:00:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 16:01:00 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 22 16:01:00 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 22 16:01:00 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 22 20:00:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 23 08:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 23 12:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 16:01:25 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 16:01:25 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 16:01:25 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 16:01:25 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 23 16:01:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 16:01:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 23 16:01:26 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 23 16:01:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 23 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 24 08:02:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 24 12:02:21 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 24 16:01:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 24 20:01:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 25 08:01:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 25 12:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 16:00:48 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 16:00:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 16:00:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 16:00:49 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 25 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 25 16:00:49 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 25 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Jan 25 20:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 08:04:50 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 08:04:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 08:04:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 08:04:50 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 26 08:04:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 08:04:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 26 08:04:50 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 26 08:04:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 26 12:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 26 16:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Jan 26 20:00:40 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 08:05:52 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 08:05:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 08:05:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 08:05:53 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 27 08:05:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 08:05:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 27 08:05:53 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 27 08:05:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 27 12:01:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 27 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Jan 27 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 08:04:54 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 08:04:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 08:04:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 08:04:54 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 28 08:04:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 08:04:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 28 08:04:55 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 28 08:04:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 28 12:01:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 16:00:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 16:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 16:00:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 16:00:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 28 16:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 16:00:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 28 16:00:43 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 28 16:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Jan 28 20:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 08:06:38 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 08:06:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 08:06:39 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 08:06:39 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 29 08:06:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 08:06:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 29 08:06:39 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 29 08:06:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 29 12:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 29 16:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Jan 29 20:00:46 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 08:07:00 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 08:07:01 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 08:07:01 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 08:07:01 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 30 08:07:01 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 08:07:01 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 30 08:07:01 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 30 08:07:01 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 12:03:25 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 12:03:26 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 12:03:26 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 12:03:26 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 30 12:03:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 12:03:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 30 12:03:26 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 30 12:03:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 30 16:03:41 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Jan 30 20:01:51 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 31 08:07:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 31 12:03:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 31 16:01:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Jan 31 20:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 1 08:08:57 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 1 12:02:19 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 1 16:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 1 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 08:11:02 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 08:11:05 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 08:11:05 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 08:11:05 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 2 08:11:05 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 08:11:05 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 2 08:11:05 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 2 08:11:05 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 2 12:02:22 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 2 16:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 2 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 08:10:21 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 08:10:25 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 08:10:25 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 08:10:25 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 3 08:10:25 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 08:10:25 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 3 08:10:25 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 3 08:10:25 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 3 12:02:13 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 3 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 3 20:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 4 08:06:28 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:13 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 12:02:13 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 12:02:13 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 12:02:13 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 4 12:02:13 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 12:02:13 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 4 12:02:14 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 4 12:02:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 16:00:59 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 16:00:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 16:00:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 16:01:00 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 4 16:01:00 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 16:01:00 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 4 16:01:00 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 4 16:01:00 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 4 20:00:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 08:06:58 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 08:06:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 08:06:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 08:06:59 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 5 08:06:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 08:06:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 5 08:06:59 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 5 08:06:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 5 12:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 5 16:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 5 20:00:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 08:11:11 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 08:11:14 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 08:11:14 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 08:11:14 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 6 08:11:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 08:11:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 6 08:11:14 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 6 08:11:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 6 12:02:11 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 6 16:00:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 6 20:00:50 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 08:17:13 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 08:17:16 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 08:17:16 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 08:17:16 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 7 08:17:16 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 08:17:16 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 7 08:17:17 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 7 08:17:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 7 12:02:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 7 16:00:56 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 20:00:51 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 20:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 7 20:00:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 20:00:55 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 7 20:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 7 20:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 7 20:00:55 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 7 20:00:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 08:18:52 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 08:18:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 08:18:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 08:18:53 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 8 08:18:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 08:18:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 8 08:18:53 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 8 08:18:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 12:02:37 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 12:02:37 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 12:02:37 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 12:02:38 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 8 12:02:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 12:02:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 8 12:02:38 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 8 12:02:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 8 16:01:01 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 8 20:00:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 08:07:40 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 08:07:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 08:07:43 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 08:07:43 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 9 08:07:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 08:07:43 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 9 08:07:43 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 9 08:07:44 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 12:02:25 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 12:02:26 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 12:02:26 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 12:02:26 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 9 12:02:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 12:02:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 9 12:02:26 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 9 12:02:26 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 9 16:01:03 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 20:00:51 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 20:00:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 9 20:00:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 20:00:54 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 9 20:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 9 20:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 9 20:00:54 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 9 20:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 08:14:48 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 08:14:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 08:14:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 08:14:48 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 10 08:14:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 08:14:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 10 08:14:49 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 10 08:14:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 10 12:02:55 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 10 16:00:52 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Feb 10 20:00:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 08:11:41 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 08:11:41 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 08:11:42 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 08:11:42 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 11 08:11:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 08:11:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 11 08:11:42 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 11 08:11:42 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 11 12:02:10 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 11 16:00:53 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sat Feb 11 20:00:48 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 12 08:08:07 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 12 12:02:17 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 12 16:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Sun Feb 12 20:00:54 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 08:14:34 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 08:14:35 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 08:14:35 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 08:14:35 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 13 08:14:35 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 08:14:35 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 13 08:14:35 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 13 08:14:35 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 12:02:28 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 12:02:28 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 12:02:28 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 12:02:28 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 13 12:02:28 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 12:02:29 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 13 12:02:29 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 13 12:02:29 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 13 16:01:05 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 20:00:46 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 20:00:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Mon Feb 13 20:00:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 20:00:47 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Mon Feb 13 20:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Mon Feb 13 20:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Mon Feb 13 20:00:47 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Mon Feb 13 20:00:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 08:16:33 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 08:16:38 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 08:16:38 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 08:16:38 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 14 08:16:38 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 08:16:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 14 08:16:39 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 14 08:16:39 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 14 12:02:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 14 16:01:14 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Tue Feb 14 20:00:58 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 08:21:46 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 08:21:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 08:21:47 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 08:21:47 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 15 08:21:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 08:21:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 15 08:21:47 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 15 08:21:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 15 12:04:35 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 15 16:01:12 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 15 19:27:49 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 20:11:44 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 20:11:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Wed Feb 15 20:11:45 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 20:11:45 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Wed Feb 15 20:11:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Wed Feb 15 20:11:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Wed Feb 15 20:11:45 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Wed Feb 15 20:11:45 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 16 08:40:42 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 16 08:40:44 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Thu Feb 16 08:40:46 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 16 08:40:46 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Thu Feb 16 08:40:46 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Thu Feb 16 08:40:46 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Thu Feb 16 08:40:47 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Thu Feb 16 08:40:47 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py From mal at lemburg.com Fri Feb 1 12:15:49 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Mar 31 16:32:58 2006 Subject: [egenix-users] Upcoming 2.1.0 release of eGenix.com mx BASE Message-ID: <3C5A78E5.4AF297C6@lemburg.com> Hi everybody, there will be a new release of the mx BASE distribution this month and I was wondering whether you'd like to test drive the current alpha of that version. Here's a short overview of what has changed: * mxTextTools does now fully support Unicode (this is a sponsored feature addition) * mxBeeBase is starting to feel at home on non-Unix platforms as well, esp. Windows where it didn't work before in locking mode. mxBeeBase offers you many possibilities, BTW, e.g. on-disk dictionaries and fast lookups. + The usual bunch of small tweaks and changes. Before the final version I also plan to add mxURL from the experimental distribution to mx base. Here's the current pre-release as distutils source package: http://www.egenix.com/files/python/egenix-mx-base-2.1.0.zip Please give it a go and let me know what you think. I'll update the above file every now and then (in place), but will post updates to this list. Thanks, -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 7 13:56:37 2002 From: maxm at mxm.dk (Max M) Date: Fri Mar 31 16:32:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime Message-ID: <3C628795.2080602@mxm.dk> I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. But I am having trouble with inserting dates ie. from mx.DateTime The error message is: ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', 4479) The only thing i could find on the net was (one line only): http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 Where somebody has the same problem: "Marc-Andre answer: Looks like MS SQL Server's ODBC driver is being too careful again. What you are seeing there is a SQL warning which mxODBC translates into an exception." the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" I would find it a lot easier to just catch the exception. But I cannot see from the traceback which exception to catch. So I have made a quick hack: try: # it bitches about dates c.execute(qs, localValues) except: pass That's about as dirty as it gets. So I wondered what the better way to do it is? As far as i can tell it just raises a general exception. Not one that I can catch explicitly. Do I really have to re-compile? And if so what is needed? regards Max M From mal at lemburg.com Thu Feb 7 17:34:44 2002 From: mal at lemburg.com (M.-A. Lemburg) Date: Fri Mar 31 16:32:59 2006 Subject: [egenix-users] problem with mx.ODBC MS SQL-server and datetime References: <3C628795.2080602@mxm.dk> Message-ID: <3C62ACA4.37A66B03@lemburg.com> Max M wrote: > > I am trying out mx.ODBC on MS sql server, and so far it goes along nicely. > > But I am having trouble with inserting dates ie. from mx.DateTime > The error message is: > ('01004', 0, '[Microsoft][ODBC SQL Server Driver]Fractional truncation', > 4479) > > The only thing i could find on the net was (one line only): > > http://groups.google.com/groups?hl=da&frame=right&th=841f8af29973b8ba&seekm=mailman.989913322.21800.python-list%40python.org#link2 > > Where somebody has the same problem: > > "Marc-Andre answer: > Looks like MS SQL Server's ODBC driver is being too careful again. > What you are seeing there is a SQL warning which mxODBC translates > into an exception." > > the advice is "recompiling the package with -DDONT_REPORT_WARNINGS" > > I would find it a lot easier to just catch the exception. But I cannot > see from the traceback which exception to catch. You'll have to catch the mx.ODBC.Windows.Warning exception and then look at the first item of the reason tuple to tell which warning was issued. Then to fix the problem, I'd suggest to convert the DateTime object to a datetime string value with only two digit fractions. str(datetime) does this for you. > So I have made a quick > hack: > > try: # it bitches about dates > c.execute(qs, localValues) > except: > pass > > That's about as dirty as it gets. So I wondered what the better way to > do it is? As far as i can tell it just raises a general exception. Not > one that I can catch explicitly. > > Do I really have to re-compile? And if so what is needed? You'll need MS VC++ installed, the Python installation and the mxODBC sources. Then python setup.py build build_ext -DDONT_REPORT_WARNINGS install will do the trick and install the new versions on top of what you probably already have installed. -- Marc-Andre Lemburg CEO eGenix.com Software GmbH ______________________________________________________________________ Company & Consulting: http://www.egenix.com/ Python Software: http://www.egenix.com/files/python/ From maxm at mxm.dk Thu Feb 21 17:15:04 2002 From: maxm at mxm.dk (Max M) Date: Fri Mar 31 16:32:59 2006 Subject: [egenix-users] comparing DateTime types Message-ID: <3C752B18.3070709@mxm.dk> Hi This works as I expect: type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) >>> 1 But this doesn't: type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) >>> 0 Do I have to compare instances? I would have thought that comparing with the "DateTimeType" directly would suffice. regards Max M From Jim.Vickroy at noaa.gov Thu Feb 21 10:26:03 2002 From: Jim.Vickroy at noaa.gov (Jim Vickroy) Date: Fri Mar 31 16:32:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <3C752DAB.3605C79A@noaa.gov> Hello Max, I'm using Python 2.2 and here is the behavior: >>> import mx.DateTime >>> type(mx.DateTime.now()) >>> type(mx.DateTime.DateTimeType) >>> mx.DateTime.DateTimeType >>> type(mx.DateTime.now()) == mx.DateTime.DateTimeType 1 >>> Note that the type of DateTimeType is 'type' which is as expected -- the type of a type is 'type'. Max M wrote: > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > > regards Max M > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > http://lists.egenix.com/mailman/listinfo/egenix-users From maxm at mxm.dk Thu Feb 21 17:29:45 2002 From: maxm at mxm.dk (Max M) Date: Fri Mar 31 16:32:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> <3C752DAB.3605C79A@noaa.gov> Message-ID: <3C752E89.4030709@mxm.dk> Jim Vickroy wrote: >Note that the type of DateTimeType is 'type' which is as expected -- the >type of a type is 'type'. > Doh! I guess gotta read up on "G?del, Escher, Bach" one more time. Especially the sections about meta levels! regards Max m From jh at web.de Thu Feb 21 19:36:20 2002 From: jh at web.de (Juergen Hermann) Date: Fri Mar 31 16:32:59 2006 Subject: [egenix-users] comparing DateTime types In-Reply-To: <3C752E89.4030709@mxm.dk> Message-ID: On Thu, 21 Feb 2002 17:29:45 +0000, Max M wrote: >I guess gotta read up on "G?del, Escher, Bach" one more time. Especially >the sections about meta levels! That apart, type checks should be done with isinstance()! Ciao, J?rgen From sholden at holdenweb.com Thu Feb 21 16:17:11 2002 From: sholden at holdenweb.com (Steve Holden) Date: Fri Mar 31 16:32:59 2006 Subject: [egenix-users] comparing DateTime types References: <3C752B18.3070709@mxm.dk> Message-ID: <00f801c1bb1d$21c09740$d200000a@holdenweb.com> ----- Original Message ----- From: "Max M" To: "egenix-users" Sent: Thursday, February 21, 2002 12:15 PM Subject: [egenix-users] comparing DateTime types > Hi > > This works as I expect: > type(mx.DateTime.now()) == type(mx.DateTime.DateTime(2002)) > >>> 1 > > But this doesn't: > type(mx.DateTime.now()) == type(mx.DateTime.DateTimeType) > >>> 0 > > Do I have to compare instances? I would have thought that comparing with > the "DateTimeType" directly would suffice. > >>> import mx.DateTime as dt >>> dt.DateTimeType >>> type(dt.now()) The magic you were looking for is probably type(mx.DateTime.now()) == mx.DateTime.DateTimeType The problem here is that type(mx.DateTime.DateTimeType) is a type, whose type should therefore be typeType. >>> type(dt.DateTimeType) Hope this helps. regards Steve -- Consulting, training, speaking: http://www.holdenweb.com/ Author, Python Web Programming: http://pydish.holdenweb.com/pwp/ "This is Python. We don't care much about theory, except where it intersects with useful practice." Aahz Maruch on c.l.py