From rdmoores at gmail.com Fri May 2 03:29:08 2008 From: rdmoores at gmail.com (Dick Moores) Date: Fri May 2 11:30:20 2008 Subject: [egenix-users] mxDateTime puzzle Message-ID: Win XP, Python 2.5.1, mxDateTime v.3 I'm trying to begin to master both Python's datetime module and mxDateTime. I have a script that does something useful for me with datetime: . Note the user is able to enter a date in informal U.S. style. E.g. yesterday's as 5/1/2008. I've tried hard to write a script that does the same with mxDateTime, but am not able to incorporate the same date style. I'm stuck at having the user enter a date as "year, month, date". This effort is at Please suggest how to modify this to meet my objective. Thanks, Dick Moores From charlie at egenix.com Fri May 2 12:45:55 2008 From: charlie at egenix.com (Charlie Clark) Date: Fri May 2 11:46:18 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: Am 02.05.2008, 11:29 Uhr, schrieb Dick Moores : > Win XP, Python 2.5.1, mxDateTime v.3 > I'm trying to begin to master both Python's datetime module and > mxDateTime. I have a script that does something useful for me with > datetime: . Note the user is > able to enter a date in informal U.S. style. E.g. yesterday's as > 5/1/2008. > I've tried hard to write a script that does the same with mxDateTime, > but am not able to incorporate the same date style. I'm stuck at > having the user enter a date as "year, month, date". This effort is at > > Please suggest how to modify this to meet my objective. Hi Dick, try: mx.DateTime.Parser.DateTimeFromString(s) Charlie -- Charlie Clark eGenix.com Professional Python Services directly from the Source >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From mal at egenix.com Fri May 2 13:37:33 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Fri May 2 12:37:52 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: <481AEEED.4090409@egenix.com> On 2008-05-02 11:29, Dick Moores wrote: > Win XP, Python 2.5.1, mxDateTime v.3 > > I'm trying to begin to master both Python's datetime module and > mxDateTime. I have a script that does something useful for me with > datetime: . Note the user is > able to enter a date in informal U.S. style. E.g. yesterday's as > 5/1/2008. > > I've tried hard to write a script that does the same with mxDateTime, > but am not able to incorporate the same date style. I'm stuck at > having the user enter a date as "year, month, date". This effort is at > > > Please suggest how to modify this to meet my objective. >>> from mx.DateTime import * >>> DateTimeFrom('5/1/2008') DateTimeFrom() is a generic interface to parsers and other constructors in mxDateTime. For more flexible date/time parsing, have a look at the mx.DateTime.Parser module. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 02 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From charlie at egenix.com Fri May 2 13:49:22 2008 From: charlie at egenix.com (Charlie Clark) Date: Fri May 2 12:50:13 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: Am 02.05.2008, 12:19 Uhr, schrieb Dick Moores : > Could you spell it out a bit more? In the manual I find: >>> import mx.DateTime >>> s = "1/13/2008" >>> mx.DateTime.Parser.DateTimeFromString(s) No need to declare the format. Charlie -- Charlie Clark eGenix.com Professional Python Services directly from the Source >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From charlie at egenix.com Fri May 2 14:16:31 2008 From: charlie at egenix.com (Charlie Clark) Date: Fri May 2 13:16:59 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: Am 02.05.2008, 13:04 Uhr, schrieb Dick Moores : > Here's my problem: > >>>> > from mx import DateTime as DT > dstr = raw_input("Enter date as month/day/year, or enter nothing for > today: ") > date = DT.Parser.DateFromString(dstr) > print date > print date - 30 > Enter date as month/day/year, or enter nothing for today: 3/3/2008 > 2008-03-03 00:00:00.00 > 2008-02-02 00:00:00.00 >>>> > I want those 2 bottom dates to be > 3/3/2008 > 2/2/2008 Dick, please keep the discussion on the list. I'm not sure I understand your problem. Do you need to display the dates in US-format. They are not good examples for parsing but they seem to be parsing correctly. With your previous error - I'm not sure if you really do have the correct version of mx.DateTime. Can you please check DT.__version__ Charlie -- Charlie Clark eGenix.com Professional Python Services directly from the Source >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From rdmoores at gmail.com Fri May 2 05:24:22 2008 From: rdmoores at gmail.com (Dick Moores) Date: Fri May 2 13:24:44 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: On Fri, May 2, 2008 at 4:16 AM, Charlie Clark wrote: > Am 02.05.2008, 13:04 Uhr, schrieb Dick Moores : > >> Here's my problem: >> >>>>> >> from mx import DateTime as DT >> dstr = raw_input("Enter date as month/day/year, or enter nothing for >> today: ") >> date = DT.Parser.DateFromString(dstr) >> print date >> print date - 30 >> Enter date as month/day/year, or enter nothing for today: 3/3/2008 >> 2008-03-03 00:00:00.00 >> 2008-02-02 00:00:00.00 >>>>> >> I want those 2 bottom dates to be >> 3/3/2008 >> 2/2/2008 > > Dick, > > please keep the discussion on the list. Sorry, my mistake. I'm not sure I understand your > problem. Do you need to display the dates in US-format. Not sure exactly what you mean by US-format. What I want is '5/1/2008' or '05/01/2008' for May 1, 2008. > They are not good > examples for parsing but they seem to be parsing correctly. With your > previous error - I'm not sure if you really do have the correct version of > mx.DateTime. Can you please check DT.__version__ >>> from mx import DateTime as DT >>> DT.__version__ '3.0.0' >>> Dick From charlie at egenix.com Fri May 2 14:37:58 2008 From: charlie at egenix.com (Charlie Clark) Date: Fri May 2 13:38:44 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: Am 02.05.2008, 13:24 Uhr, schrieb Dick Moores : > Sorry, my mistake. > I'm not sure I understand your >> problem. Do you need to display the dates in US-format. > Not sure exactly what you mean by US-format. What I want is '5/1/2008' > or '05/01/2008' for May 1, 2008. That is how it's being parsed. mx.DateTime always represents dates using the ISO format YYYY-MM-DD to try and avoid such ambiguities. Charlie -- Charlie Clark eGenix.com Professional Python Services directly from the Source >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From charlie at egenix.com Fri May 2 14:48:18 2008 From: charlie at egenix.com (Charlie Clark) Date: Fri May 2 13:48:58 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: Am 02.05.2008, 13:44 Uhr, schrieb Dick Moores : > On Fri, May 2, 2008 at 4:37 AM, Charlie Clark wrote: >> Am 02.05.2008, 13:24 Uhr, schrieb Dick Moores : >> >>> Sorry, my mistake. >>> I'm not sure I understand your >>>> >>>> problem. Do you need to display the dates in US-format. >>> >>> Not sure exactly what you mean by US-format. What I want is '5/1/2008' >>> or '05/01/2008' for May 1, 2008. >> >> That is how it's being parsed. mx.DateTime always represents dates >> using the >> ISO format YYYY-MM-DD to try and avoid such ambiguities. > > So there's no way to print the result of date + n in the form I want? > > If you looked at > > You'll see I succeeded in this using datetime: > > Enter date as month/day/year, or enter nothing for today: 1/1/2009 > Date entered was 01/01/2009 > Enter positive int for days after date; negative int for days before > date. > Enter the number of days: -200 > 01/01/2009 minus 200 days is 06/15/2008 > > Dick Sure, tell it the format you want just with datetime >>> a.strftime("%m/%d/%Y") '03/03/2008' >>> a + 15 >>> _.strftime('%m/%d/%Y') '03/18/2008' Charlie -- Charlie Clark eGenix.com Professional Python Services directly from the Source >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From rdmoores at gmail.com Fri May 2 06:44:18 2008 From: rdmoores at gmail.com (Dick Moores) Date: Fri May 2 14:44:38 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: On Fri, May 2, 2008 at 4:48 AM, Charlie Clark wrote: > Am 02.05.2008, 13:44 Uhr, schrieb Dick Moores : > >> On Fri, May 2, 2008 at 4:37 AM, Charlie Clark wrote: >>> >>> Am 02.05.2008, 13:24 Uhr, schrieb Dick Moores : >>> >>>> Sorry, my mistake. >>>> I'm not sure I understand your >>>>> >>>>> problem. Do you need to display the dates in US-format. >>>> >>>> Not sure exactly what you mean by US-format. What I want is '5/1/2008' >>>> or '05/01/2008' for May 1, 2008. >>> >>> That is how it's being parsed. mx.DateTime always represents dates using >>> the >>> ISO format YYYY-MM-DD to try and avoid such ambiguities. >> >> So there's no way to print the result of date + n in the form I want? >> >> If you looked at >> >> You'll see I succeeded in this using datetime: >> >> Enter date as month/day/year, or enter nothing for today: 1/1/2009 >> Date entered was 01/01/2009 >> Enter positive int for days after date; negative int for days before date. >> Enter the number of days: -200 >> 01/01/2009 minus 200 days is 06/15/2008 >> >> Dick > > Sure, tell it the format you want just with datetime > >>>> a.strftime("%m/%d/%Y") No, that fails for year < 1900 > > '03/03/2008' >>>> >>>> a + 15 > > >>>> >>>> _.strftime('%m/%d/%Y') > > '03/18/2008' Yes, I've got it now! See Thanks for your help, Charlie. Dick From rdmoores at gmail.com Fri May 2 15:42:27 2008 From: rdmoores at gmail.com (Dick Moores) Date: Fri May 2 14:44:47 2008 Subject: [egenix-users] mxDateTime puzzle In-Reply-To: References: Message-ID: On Fri, May 2, 2008 at 4:48 AM, Charlie Clark wrote: > Am 02.05.2008, 13:44 Uhr, schrieb Dick Moores : > >> On Fri, May 2, 2008 at 4:37 AM, Charlie Clark >> wrote: >>> >>> Am 02.05.2008, 13:24 Uhr, schrieb Dick Moores : >>> >>>> Sorry, my mistake. >>>> I'm not sure I understand your >>>>> >>>>> problem. Do you need to display the dates in US-format. >>>> >>>> Not sure exactly what you mean by US-format. What I want is '5/1/2008' >>>> or '05/01/2008' for May 1, 2008. >>> >>> That is how it's being parsed. mx.DateTime always represents dates >>> using >>> the >>> ISO format YYYY-MM-DD to try and avoid such ambiguities. >> >> So there's no way to print the result of date + n in the form I want? >> >> If you looked at >> >> You'll see I succeeded in this using datetime: >> >> Enter date as month/day/year, or enter nothing for today: 1/1/2009 >> Date entered was 01/01/2009 >> Enter positive int for days after date; negative int for days before >> date. >> Enter the number of days: -200 >> 01/01/2009 minus 200 days is 06/15/2008 >> >> Dick > > Sure, tell it the format you want just with datetime > >>>> a.strftime("%m/%d/%Y") No, that fails for year < 1900 > > '03/03/2008' >>>> >>>> a + 15 > > >>>> >>>> _.strftime('%m/%d/%Y') > > '03/18/2008' Yes, I've got it now! See Thanks for your help, Charlie. Dick From etyrer at york.cuny.edu Fri May 2 23:21:24 2008 From: etyrer at york.cuny.edu (Eric S Tyrer II) Date: Sat May 3 04:22:09 2008 Subject: [egenix-users] trying to figure out mx.ODBC buildout recipe Message-ID: Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 3048 bytes Desc: not available Url : /mailman-archives/egenix-users/attachments/20080502/e74406df/smime.bin From mj at zopatista.com Sat May 3 11:58:19 2008 From: mj at zopatista.com (Martijn Pieters) Date: Sat May 3 10:58:40 2008 Subject: [egenix-users] trying to figure out mx.ODBC buildout recipe In-Reply-To: References: Message-ID: <21a6ef160805030158g5f35e99g79aa7d4cbd3b322e@mail.gmail.com> On Sat, May 3, 2008 at 4:21 AM, Eric S Tyrer II wrote: > I am trying to build mxODBC Zope DA adapter for my Plone 3.1.1 setup with no > success. I understand (I think) python/buildout so I proceeded with the > following: > > I am using the Plone unified installer (new now uses buildout). Since this > is a development egg: > > I have checked out the trunk to my src directory as > collective.recipe.mxodbc. > > I cd to src/collective.recipe.mxodbc which has setup.py setup.cfg & > collective folder > > I call python at /opt/Plone-3.1/Python-2.4/bin/python setup.py install with > the following output You do not need to run setup.py manually, buildout will take care of this for you because you included src/collective.recipe.mxodbc in the develop line. You'll now need to add a part that uses the mxodbc recipe and you'll need to include the resulting location in the extra-paths option for your zope2instance parts (and optionally for the zopepy part): [buildout] ... develop = src/collective.recipe.mxodbc parts = ... mxodbc [mxodbc] recipe = collective.recipe.mxodbc license-key = xxxx-xxxx-xxxx-xxxx-xxxx-xxxx [client1] recipe = plone.recipe.zope2instance ... extra-paths = ${mxodbc:location} [client2] recipe = plone.recipe.zope2instance ... extra-paths = ${mxodbc:location} [zopepy] recipe = zc.recipe.egg ... extra-paths = ${zope2:location}/lib/python ${mxodbc:location} Again, there is no need to run the recipe setup.py by hand. I've corrected the namespace warning in subversion, thanks for reporting that; the warning was added to setuptools more recently so I never saw it during development. -- Martijn Pieters From rdmoores at gmail.com Mon May 5 02:37:16 2008 From: rdmoores at gmail.com (Dick Moores) Date: Mon May 5 10:37:55 2008 Subject: [egenix-users] mxDateTime problem Message-ID: Use this file for temporary saving. E.g. for drafting an email. Please see my daysDelta24.py at "Compute the difference in days (and weeks and days) between 2 dates. E.g., The difference between 07/04/1776 and 09/11/2001 is 82248 days Or 11749 weeks and 5 days" The user is instructed to "Enter date as month/day/year, or enter nothing for today", for both dates. If for one date he chooses to enter nothing in order to make that date today's date, the script fails--the computed difference between the dates will be short by 1. Thus, if the dates are 5/5/2008 (today's date entered by entering nothing) and 5/8/2008, the computed difference will be 2. If instead, both of these dates had been entered "manually", the computed difference will be 3. (See outputs #3 and #4, lines 107-126) I believe the error is caused by getDate() returning DT.now() when the user enters "". DT.now() is, for example, 2008-05-05 00:51:34.00 (my local time at time of writing), not 2008-05-05 00:00:00.00, whereas the other date entered, for example 5/8/2008, will be returned as 2008-05-11 00:00:00.00. >>> from mx import DateTime as DT >>> print DT.now() 2008-05-05 00:51:34.00 >>> dstr = "5/8/2008" >>> print DT.Parser.DateFromString(dstr, ('us',)) 2008-05-08 00:00:00.00 >>> In line 48 (2008-08-11 00:00:00.00 - 2008-05-05 00:51:34.00).days will be computed as 2 days, not 3. I've used mxDateTime instead of the Python module datetime because datetime can't handle dates earlier than the year 1900. Can anyone tell me how to correct this problem? Thanks, Dick Moores From charlie at egenix.com Mon May 5 11:51:10 2008 From: charlie at egenix.com (Charlie Clark) Date: Mon May 5 10:52:11 2008 Subject: [egenix-users] mxDateTime problem In-Reply-To: References: Message-ID: Am 05.05.2008, 10:37 Uhr, schrieb Dick Moores : Dick, it would be nice to have the problem stated clearly at the top of the e-mail. > Use this file for temporary saving. E.g. for drafting an email. > Please see my daysDelta24.py at > > "Compute the difference in days (and weeks and days) between 2 dates. > E.g., The difference between 07/04/1776 and 09/11/2001 is 82248 days > Or 11749 weeks and 5 days" > The user is instructed to "Enter date as month/day/year, or enter > nothing for today", for both dates. If for one date he chooses to > enter nothing in order to make that date today's date, the script > fails--the computed difference between the dates will be short by 1. > Thus, if the dates are 5/5/2008 (today's date entered by entering > nothing) and 5/8/2008, the computed difference will be 2. If instead, > both of these dates had been entered "manually", the computed > difference will be 3. (See outputs #3 and #4, lines 107-126) > I believe the error is caused by getDate() returning DT.now() when the > user enters "". DT.now() is, for example, 2008-05-05 00:51:34.00 (my > local time at time of writing), not 2008-05-05 00:00:00.00, whereas > the other date entered, for example 5/8/2008, will be returned as > 2008-05-11 00:00:00.00. > >>>> from mx import DateTime as DT >>>> print DT.now() > 2008-05-05 00:51:34.00 >>>> dstr = "5/8/2008" >>>> print DT.Parser.DateFromString(dstr, ('us',)) > 2008-05-08 00:00:00.00 >>>> This is the problem? > In line 48 (2008-08-11 00:00:00.00 - 2008-05-05 00:51:34.00).days will > be computed as 2 days, not 3. Well, the difference between the two datetimes is 2 days + 23 hours... and you are only asking for the days. > I've used mxDateTime instead of the Python module datetime because > datetime can't handle dates earlier than the year 1900. > Can anyone tell me how to correct this problem? You should coerce mx.DateTime.now() to create a Date object (ie. no time). That should solve your problem. Charlie -- Charlie Clark eGenix.com Professional Python Services directly from the Source >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From mal at egenix.com Mon May 5 11:53:03 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Mon May 5 10:53:25 2008 Subject: [egenix-users] mxDateTime problem In-Reply-To: References: Message-ID: <481ECAEF.6050608@egenix.com> On 2008-05-05 10:37, Dick Moores wrote: > Use this file for temporary saving. E.g. for drafting an email. > > Please see my daysDelta24.py at > > "Compute the difference in days (and weeks and days) between 2 dates. > E.g., The difference between 07/04/1776 and 09/11/2001 is 82248 days > Or 11749 weeks and 5 days" > > The user is instructed to "Enter date as month/day/year, or enter > nothing for today", for both dates. If for one date he chooses to > enter nothing in order to make that date today's date, the script > fails--the computed difference between the dates will be short by 1. > Thus, if the dates are 5/5/2008 (today's date entered by entering > nothing) and 5/8/2008, the computed difference will be 2. If instead, > both of these dates had been entered "manually", the computed > difference will be 3. (See outputs #3 and #4, lines 107-126) > > I believe the error is caused by getDate() returning DT.now() when the > user enters "". If you change your getDate() to use DateTime.today() the problem should go away. The mxDateTime parsers default to 00:00:00 for the time part if no time part is found. DateTime.today() does the same - it returns the current date at midnight. > DT.now() is, for example, 2008-05-05 00:51:34.00 (my > local time at time of writing), not 2008-05-05 00:00:00.00, whereas > the other date entered, for example 5/8/2008, will be returned as > 2008-05-11 00:00:00.00. > >>>> from mx import DateTime as DT >>>> print DT.now() > 2008-05-05 00:51:34.00 >>>> dstr = "5/8/2008" >>>> print DT.Parser.DateFromString(dstr, ('us',)) > 2008-05-08 00:00:00.00 > > In line 48 (2008-08-11 00:00:00.00 - 2008-05-05 00:51:34.00).days will > be computed as 2 days, not 3. > > I've used mxDateTime instead of the Python module datetime because > datetime can't handle dates earlier than the year 1900. > > Can anyone tell me how to correct this problem? > > Thanks, > > Dick Moores -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 05 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From fpierfed at lsst.org Tue May 6 15:27:53 2008 From: fpierfed at lsst.org (Francesco Pierfederici) Date: Tue May 6 23:34:46 2008 Subject: [egenix-users] DateTimeFromString off by one sec? Message-ID: <1d7144ea0805061427x4e29f0cdwc5c1869357e891fe@mail.gmail.com> Hi, I am using mx.DateTime to parse dates and times in ISO format. I have noticed that DateTimeFromString seems to be off by one second if the time string being parsed ends with :59 >>> mx.DateTime.Parser.DateTimeFromString('2008-05-06T19:30:09.59') but >>> mx.DateTime.Parser.DateTimeFromString('2008-05-06T19:30:09.58') Adding formats=['iso', ] does not change the results. I am using mx.DateTime 3.0 by the way. Am I doing something wrong? Thank you! Francesco From mal at egenix.com Wed May 7 11:33:23 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed May 7 10:33:44 2008 Subject: [egenix-users] DateTimeFromString off by one sec? In-Reply-To: <1d7144ea0805061427x4e29f0cdwc5c1869357e891fe@mail.gmail.com> References: <1d7144ea0805061427x4e29f0cdwc5c1869357e891fe@mail.gmail.com> Message-ID: <48216953.5080700@egenix.com> On 2008-05-06 23:27, Francesco Pierfederici wrote: > Hi, > > I am using mx.DateTime to parse dates and times in ISO format. I have > noticed that DateTimeFromString seems to be off by one second if the > time string being parsed ends with :59 > >>>> mx.DateTime.Parser.DateTimeFromString('2008-05-06T19:30:09.59') > > > but > >>>> mx.DateTime.Parser.DateTimeFromString('2008-05-06T19:30:09.58') > > > Adding formats=['iso', ] does not change the results. I am using > mx.DateTime 3.0 by the way. > > > Am I doing something wrong? It is not not off by a second, it's off by 1/100 of a second. This looks a lot like a bug in the parser, since it starts to parse the fraction with a 1/100 second offset starting at x.59 onwards: >>> DateTimeFrom('2008-05-06 19:30:09.57') >>> DateTimeFrom('2008-05-06 19:30:09.58') >>> DateTimeFrom('2008-05-06 19:30:09.59') >>> DateTimeFrom('2008-05-06 19:30:09.60') >>> DateTimeFrom('2008-05-06 19:30:09.61') >>> DateTimeFrom('2008-05-06 19:30:09.62') Note that it works again, if you use three decimal places: >>> DateTimeFrom('2008-05-06 19:30:09.591') >>> DateTimeFrom('2008-05-06 19:30:09.601') However: >>> DateTimeFrom('2008-05-06 19:30:09.590') >>> DateTimeFrom('2008-05-06 19:30:09.600') Weird bug :-) I'll open a ticket for this. Thank you for reporting this, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 07 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From mal at egenix.com Wed May 7 12:00:55 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed May 7 11:01:12 2008 Subject: [egenix-users] DateTimeFromString off by one sec? In-Reply-To: <48216953.5080700@egenix.com> References: <1d7144ea0805061427x4e29f0cdwc5c1869357e891fe@mail.gmail.com> <48216953.5080700@egenix.com> Message-ID: <48216FC7.7030808@egenix.com> On 2008-05-07 10:33, M.-A. Lemburg wrote: > On 2008-05-06 23:27, Francesco Pierfederici wrote: >> Hi, >> >> I am using mx.DateTime to parse dates and times in ISO format. I have >> noticed that DateTimeFromString seems to be off by one second if the >> time string being parsed ends with :59 >> >>>>> mx.DateTime.Parser.DateTimeFromString('2008-05-06T19:30:09.59') >> >> >> but >> >>>>> mx.DateTime.Parser.DateTimeFromString('2008-05-06T19:30:09.58') >> >> >> Adding formats=['iso', ] does not change the results. I am using >> mx.DateTime 3.0 by the way. >> >> >> Am I doing something wrong? > > It is not not off by a second, it's off by 1/100 of a second. > > This looks a lot like a bug in the parser, since it starts to > parse the fraction with a 1/100 second offset starting at > x.59 onwards: > > >>> DateTimeFrom('2008-05-06 19:30:09.57') > > > >>> DateTimeFrom('2008-05-06 19:30:09.58') > > > >>> DateTimeFrom('2008-05-06 19:30:09.59') > > > >>> DateTimeFrom('2008-05-06 19:30:09.60') > > > >>> DateTimeFrom('2008-05-06 19:30:09.61') > > > >>> DateTimeFrom('2008-05-06 19:30:09.62') > > > Note that it works again, if you use three decimal places: > > >>> DateTimeFrom('2008-05-06 19:30:09.591') > > > >>> DateTimeFrom('2008-05-06 19:30:09.601') > > > However: > > >>> DateTimeFrom('2008-05-06 19:30:09.590') > > > >>> DateTimeFrom('2008-05-06 19:30:09.600') > > > Weird bug :-) It appears to be a classical float rounding problem: >>> DateTimeFrom('2008-05-06 19:30:09.58').second 9.5800000000000001 >>> DateTimeFrom('2008-05-06 19:30:09.59').second 9.5899999999999999 >>> DateTimeFrom('2008-05-06 19:30:09.60').second 9.5999999999999996 >>> DateTimeFrom('2008-05-06 19:30:09.61').second 9.6099999999999994 The value is parsed correctly using float(): >>> float('09.58') 9.5800000000000001 >>> float('09.59') 9.5899999999999999 >>> float('09.60') 9.5999999999999996 >>> float('09.61') 9.6099999999999994 It's just that the string formatting code truncates the seconds value after two decimal places (to avoid cases where it would print '19:30:60' using rounding). I'm not sure how we could solve this. Perhaps we should round for second values up to 59.99 (to two decimal places) and truncate only for > 59.99 ?! -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 07 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From rdmoores at gmail.com Wed May 7 04:09:20 2008 From: rdmoores at gmail.com (Dick Moores) Date: Wed May 7 12:37:02 2008 Subject: [egenix-users] At what year does (yy, mm, dd) become (19yy, mm, dd)? Message-ID: For mxDateTime. I know I saw this in the manual, but I can't locate it again. Thanks, Dick Moores From mal at egenix.com Wed May 7 14:36:09 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed May 7 13:36:33 2008 Subject: [egenix-users] At what year does (yy, mm, dd) become (19yy, mm, dd)? In-Reply-To: References: Message-ID: <48219429.80002@egenix.com> On 2008-05-07 12:09, Dick Moores wrote: > For mxDateTime. > > I know I saw this in the manual, but I can't locate it again. Note about the Y2K problems: The parser can only handle years with at least 2 digits. 2 digit year values get expanded by adding the century using DateTime.add_century(), while 3 digit year get converted literally. To have 2 digit years also be interpreted literally, add leading zeros, e.g. year 99 must be written as 099 or 0099. def add_century(year): """ Sliding window approach to the Y2K problem: adds a suitable century to the given year and returns it as integer. The window used depends on the current year (at import time). If adding the current century to the given year gives a year within the range current_year-70...current_year+30 [both inclusive], then the current century is added. Otherwise the century (current + 1 or - 1) producing the smallest difference is chosen. """ HTH, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 07 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From mal at egenix.com Wed May 7 17:04:22 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed May 7 16:04:45 2008 Subject: [egenix-users] At what year does (yy, mm, dd) become (19yy, mm, dd)? In-Reply-To: References: <48219429.80002@egenix.com> Message-ID: <4821B6E6.30408@egenix.com> On 2008-05-07 15:56, Dick Moores wrote: > On Wed, May 7, 2008 at 4:36 AM, M.-A. Lemburg wrote: >> On 2008-05-07 12:09, Dick Moores wrote: >>> For mxDateTime. >>> >>> I know I saw this in the manual, but I can't locate it again. >> Note about the Y2K problems: >> >> The parser can only handle years with at least 2 digits. 2 >> digit year values get expanded by adding the century using >> DateTime.add_century(), while 3 digit year get converted >> literally. To have 2 digit years also be interpreted literally, >> add leading zeros, e.g. year 99 must be written as 099 or 0099. >> >> def add_century(year): >> >> """ Sliding window approach to the Y2K problem: adds a suitable >> century to the given year and returns it as integer. >> >> The window used depends on the current year (at import time). >> If adding the current century to the given year gives a year >> within the range current_year-70...current_year+30 [both >> inclusive], then the current century is added. Otherwise the >> century (current + 1 or - 1) producing the smallest difference is >> chosen. > > Sorry, but I can't follow that. Please give some examples. From my own > testing, I can see that for current year 2008, if 2-digit years are > represented by yy, then if yy <= 38, the century is the 21st (20yy). > Whereas if yy > 39, the century is the 20th (19yy). But I don't > understand what happens when the current year changes. Please > illustrate your rule with some well-chosen examples. > > Examples for my narrow rule: (38, 1, 1) -> (2038, 01, 01); (39, 1, > 1) -> (1939, 01, 01); (87, 12, 31) -> (1987, 12, 31); (01, 9, 11) -> > (2001, 09, 11) Those two snippets were taken from Parser.py and DateTime.py. Please have a look at add_century() in DateTime.py for more information on the algorithm. This function is always called when the parser finds that a two-digit year was used, regardless of the month and day: _current_year = now().year _current_century, _current_year_in_century = divmod(_current_year, 100) _current_century = _current_century * 100 def add_century(year, current_year=_current_year, current_century=_current_century): """ Sliding window approach to the Y2K problem: adds a suitable century to the given year and returns it as integer. The window used depends on the current year (at import time). If adding the current century to the given year gives a year within the range current_year-70...current_year+30 [both inclusive], then the current century is added. Otherwise the century (current + 1 or - 1) producing the smallest difference is chosen. """ if year > 99: # Take it as-is return year year = year + current_century diff = year - current_year if diff >= -70 and diff <= 30: return year elif diff < -70: return year + 100 else: return year - 100 -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 07 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From mal at egenix.com Thu May 8 14:18:08 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Thu May 8 13:18:48 2008 Subject: [egenix-users] Re: Installing using buildout In-Reply-To: <7CD69867FCBA0F4694B0C053BF093313018B4670@POSTINO.pselc.internal> References: <7CD69867FCBA0F4694B0C053BF093313018B4670@POSTINO.pselc.internal> Message-ID: <4822E170.7040806@egenix.com> [CCing egenix-users, since this can be useful for others as well; I've removed the license details from the original mail to support] On 2008-05-08 02:57, Cliff Quinn wrote: > I'm trying to migrate my original installation of mxODBC (I have a license under x@y.com) to a linux ubuntu6.06 installation of plone 3.1.1 using buildout. I'm not a linux or python pro and I'm trying to understand this. > > > > I have used the instructions at: http://www.egenix.com/mailman-archives/egenix-users/2008-May/114382.html having downloaded the source using svn. I am getting some errors as it compiles like: > > > > mx/UID/mxUID/mxUID.c: In function ?mxUID_Verify?: > > mx/UID/mxUID/mxUID.c:333: warning: pointer targets in passing argument 1 of ?sscanf? differ in signedness > > mx/UID/mxUID/mxUID.c: In function ?mxUID_New?: > > mx/UID/mxUID/mxUID.c:462: warning: pointer targets in passing argument 1 of ?mxUID_CRC16? differ in signedness Those are compiler warnings that you can safely ignore. > While: > > Installing mxodbc. > > Error: License key not found: xxxx > > > > I added a file mxodbc-licenses.zip to this buildout as previous error messages seemed to indicate it was need, and I put the original license.py, pyc and .txt in it. I used the license key from the .txt file for the buildout.cfg license line. > > Any thoughts on how this can work? Where should the license be, and what should be in it? Should I not bother with the buildout? Where do the files go if I don't use buildout? The mxodbc-licenses.zip file needs to be the (renamed) licenses.zip file that we sent you with the license email. Those files contain the licenses per CPU each in their own directory named after the license key. The recipe will look in that directory and raise an error if it cannot find it. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 08 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From pigolkine at gmx.de Wed May 14 09:37:12 2008 From: pigolkine at gmx.de (Alexandre Pigolkine) Date: Wed May 14 08:37:48 2008 Subject: [egenix-users] Newlines and VARBINARY Message-ID: <20080514063712.152350@gmx.net> Hello all, I try to use mx.ODBC in the following environment: mx.ODBC, Linux, iODBC, FreeTDS-Library, Microsoft SQL Server. I get an error message when I try to insert a string with new lines into a table with a TEXT field: import mx.ODBC con = mx.ODBC.iODBC.DriverConnect("DRIVER={SQL Server};SERVER=;DATABASE=;UID=;PWD=") cur = con.cursor() cur.execute("CREATE TABLE #test (t text)") cur.close() cur = con.cursor() cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n',)) cur.close() con.close() /etc/odbcinst.ini: [ODBC Drivers] TDS MSSQL = installed [SQL Server] Description = TDS MSSQL ODBC Driver v 4.2 Driver = /usr/local/lib/libtdsodbc.so after the line cur.execute("INSERT ... ") I get an error: >>> cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n',)) Traceback (most recent call last): File "", line 1, in ? mx.ODBC.Error.ProgrammingError: ('22018', 206, '[FreeTDS][SQL Server]Operand type clash: varbinary is incompatible with text', 7028) Part of freetds-Log: token.c:2159:tds_process_end() state set to TDS_IDLE util.c:119:Changing query state from READING to IDLE util.c:119:Changing query state from IDLE to PENDING token.c:514:tds_process_tokens() state is COMPLETED sql2tds.c:151:type=-3 sql2tds.c:157:trace sql2tds.c:344:trace odbc.c:2506:Creating prepared statement util.c:119:Changing query state from IDLE to QUERYING mem.c:519:tds_free_all_results() write.c:134:tds_put_string converting 3 bytes of "@P1" write.c:162:tds_put_string wrote 6 bytes util.c:119:Changing query state from QUERYING to PENDING net.c:673:Sending packet 0000 03 01 00 9c 00 00 01 00-ff ff 0b 00 00 00 00 01 |........ ........| 0010 26 04 00 00 00 63 20 00-00 00 09 04 c0 00 69 20 |&....c . ......i | 0020 00 00 00 40 00 50 00 31-00 20 00 56 00 41 00 52 |...@.P.1 . .V.A.R| 0030 00 42 00 49 00 4e 00 41-00 52 00 59 00 28 00 39 |.B.I.N.A .R.Y.(.9| 0040 00 29 00 00 00 63 40 00-00 00 09 04 c0 00 69 40 |.)...c@. ......i@| 0050 00 00 00 49 00 4e 00 53-00 45 00 52 00 54 00 20 |...I.N.S .E.R.T. | 0060 00 49 00 4e 00 54 00 4f-00 20 00 23 00 74 00 65 |.I.N.T.O . .#.t.e| 0070 00 73 00 74 00 28 00 74-00 29 00 20 00 56 00 41 |.s.t.(.t .). .V.A| 0080 00 4c 00 55 00 45 00 53-00 28 00 40 00 50 00 31 |.L.U.E.S .(.@.P.1| 0090 00 29 00 00 00 26 04 04-01 00 00 00 |.)...&.. ....| util.c:119:Changing query state from PENDING to READING net.c:446:Received header 0000 04 01 01 18 00 3b 01 00- |.....;..| net.c:542:Received packet 0000 aa 8c 00 ce 00 00 00 02-10 37 00 4f 00 70 00 65 |........ .7.O.p.e| 0010 00 72 00 61 00 6e 00 64-00 20 00 74 00 79 00 70 |.r.a.n.d . .t.y.p| 0020 00 65 00 20 00 63 00 6c-00 61 00 73 00 68 00 3a |.e. .c.l .a.s.h.:| 0030 00 20 00 76 00 61 00 72-00 62 00 69 00 6e 00 61 |. .v.a.r .b.i.n.a| 0040 00 72 00 79 00 20 00 69-00 73 00 20 00 69 00 6e |.r.y. .i .s. .i.n| 0050 00 63 00 6f 00 6d 00 70-00 61 00 74 00 69 00 62 |.c.o.m.p .a.t.i.b| 0060 00 6c 00 65 00 20 00 77-00 69 00 74 00 68 00 20 |.l.e. .w .i.t.h. | 0070 00 74 00 65 00 78 00 74-00 09 54 00 52 00 56 00 |.t.e.x.t ..T.R.V.| 0080 4d 00 53 00 52 00 56 00-30 00 31 00 00 01 00 aa |M.S.R.V. 0.1.....| 0090 64 00 f4 1f 00 00 01 10-23 00 53 00 74 00 61 00 |d....... #.S.t.a.| 00a0 74 00 65 00 6d 00 65 00-6e 00 74 00 28 00 73 00 |t.e.m.e. n.t.(.s.| 00b0 29 00 20 00 63 00 6f 00-75 00 6c 00 64 00 20 00 |). .c.o. u.l.d. .| 00c0 6e 00 6f 00 74 00 20 00-62 00 65 00 20 00 70 00 |n.o.t. . b.e. .p.| 00d0 72 00 65 00 70 00 61 00-72 00 65 00 64 00 2e 00 |r.e.p.a. r.e.d...| 00e0 09 54 00 52 00 56 00 4d-00 53 00 52 00 56 00 30 |.T.R.V.M .S.R.V.0| 00f0 00 31 00 00 01 00 79 f4-1f 00 00 ac 09 00 00 01 |.1....y. ........| 0100 00 00 00 00 26 04 00 fe-02 00 e0 00 00 00 00 00 |....&... ........| Is there a way to avoid such behavior and force mxODBC to always pass strings as a varchar-type? Thanks a lot in advance. Alexander Pigolkin From mal at egenix.com Wed May 14 12:36:08 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed May 14 11:36:27 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <20080514063712.152350@gmx.net> References: <20080514063712.152350@gmx.net> Message-ID: <482AB288.9050404@egenix.com> On 2008-05-14 08:37, Alexandre Pigolkine wrote: > Hello all, > > I try to use mx.ODBC in the following environment: > mx.ODBC, Linux, iODBC, FreeTDS-Library, Microsoft SQL Server. > > I get an error message when I try to insert a string with > new lines into a table with a TEXT field: > > import mx.ODBC > con = mx.ODBC.iODBC.DriverConnect("DRIVER={SQL Server};SERVER=;DATABASE=;UID=;PWD=") Just a note: it is usually better to define an ODBC data source in /etc/odbc.ini with all the connection details and then use "DSN=datasourcename;UID=uid;PWD=pwd" in your application. > cur = con.cursor() > cur.execute("CREATE TABLE #test (t text)") > cur.close() > cur = con.cursor() > cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n',)) > cur.close() > con.close() > > /etc/odbcinst.ini: > [ODBC Drivers] > TDS MSSQL = installed > > [SQL Server] > Description = TDS MSSQL ODBC Driver v 4.2 > Driver = /usr/local/lib/libtdsodbc.so Did you also configure TDS to use the right TDS version for talking to the server ? BTW: Which versions of iODBC, FreeTDS and SQL Server are you using ? > after the line cur.execute("INSERT ... ") I get an error: >>>> cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n',)) > Traceback (most recent call last): > File "", line 1, in ? > mx.ODBC.Error.ProgrammingError: ('22018', 206, '[FreeTDS][SQL Server]Operand type clash: varbinary is incompatible with text', 7028) Some background: FreeTDS uses the Python type binding of mxODBC where it looks at the types you pass in to bind them to the ODBC driver (as opposed to the SQL type binding where mxODBC uses the type information from the ODBC driver). In order to check whether to bind a variable as character or binary data, mxODBC scans the data and then decides based on its findings whether to use VARCHAR or VARBINARY. Now, according to the MS docs, character data is either: * Uppercase and lowercase characters such as a, b, and C. * Numerals such as 1, 2, and 3. * Special characters such as the "at" sign (@), ampersand (&), and exclamation point (!). (see http://msdn.microsoft.com/en-us/library/ms175055.aspx) The test we are applying therefore checks for character data to be in the range [0x20 ... 0x7f]. The newline character 0x10 is not included in that range, which is why mxODBC sends such data as VARBINARY. > Is there a way to avoid such behavior and force mxODBC to always pass > strings as a varchar-type? Please check whether you see the same problem when using longer strings, e.g. ones with 500 bytes. We'll investigate this a bit more and if needed issue a patch release to address the problem. Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 14 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From pigolkine at gmx.de Wed May 14 13:41:43 2008 From: pigolkine at gmx.de (Alexandre Pigolkine) Date: Wed May 14 12:42:08 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <482AB288.9050404@egenix.com> References: <20080514063712.152350@gmx.net> <482AB288.9050404@egenix.com> Message-ID: <20080514104143.79090@gmx.net> Thanks for the tip for connection string and freetds configurations. > > BTW: Which versions of iODBC, FreeTDS and SQL Server are > you using ? > iodbc-3.52.6 freetds-0.64 SQL Server 2005 SP 2 > > Now, according to the MS docs, character data is either: > > * Uppercase and lowercase characters such as a, b, and C. > * Numerals such as 1, 2, and 3. > * Special characters such as the "at" sign (@), ampersand (&), and > exclamation point (!). > > (see http://msdn.microsoft.com/en-us/library/ms175055.aspx) > > The test we are applying therefore checks for character data > to be in the range [0x20 ... 0x7f]. > > The newline character 0x10 is not included in that range, which > is why mxODBC sends such data as VARBINARY. IMHO, HT,LF and CR are also special characters such as @, & etc. and it would be good to include them in varchar-range. For example following script works nicely in SQL Manager: create table #temp(a varchar(250)) go insert into #temp values ('213234 qwewqesad 123') go select * from #temp > > > Is there a way to avoid such behavior and force mxODBC to always pass > > strings as a varchar-type? > > Please check whether you see the same problem when using longer > strings, e.g. ones with 500 bytes. I modified INSERT-line and now I get this result: cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n1234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890',)) Traceback (most recent call last): File "", line 1, in ? mx.ODBC.Error.ProgrammingError: ('22018', 206, '[FreeTDS][SQL Server]Operand type clash: image is incompatible with text', 7028) > > We'll investigate this a bit more and if needed issue a patch > release to address the problem. > > Thanks, > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Source (#1, May 14 2008) > >>> Python/Zope Consulting and Support ... http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ > ________________________________________________________________________ > > :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: > > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 Best regards, Alexander Pigolkin From mal at egenix.com Wed May 14 13:48:48 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed May 14 12:49:03 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <20080514104143.79090@gmx.net> References: <20080514063712.152350@gmx.net> <482AB288.9050404@egenix.com> <20080514104143.79090@gmx.net> Message-ID: <482AC390.6040206@egenix.com> On 2008-05-14 12:41, Alexandre Pigolkine wrote: > Thanks for the tip for connection string and freetds configurations. > >> BTW: Which versions of iODBC, FreeTDS and SQL Server are >> you using ? >> > iodbc-3.52.6 > freetds-0.64 > SQL Server 2005 SP 2 > >> Now, according to the MS docs, character data is either: >> >> * Uppercase and lowercase characters such as a, b, and C. >> * Numerals such as 1, 2, and 3. >> * Special characters such as the "at" sign (@), ampersand (&), and >> exclamation point (!). >> >> (see http://msdn.microsoft.com/en-us/library/ms175055.aspx) >> >> The test we are applying therefore checks for character data >> to be in the range [0x20 ... 0x7f]. >> >> The newline character 0x10 is not included in that range, which >> is why mxODBC sends such data as VARBINARY. > > IMHO, HT,LF and CR are also special characters such as @, & etc. > and it would be good to include them in varchar-range. For example > following script works nicely in SQL Manager: > > create table #temp(a varchar(250)) > go > insert into #temp values ('213234 > qwewqesad 123') > go > select * from #temp We've tried to find a complete list of valid characters for CHAR, VARCHAR and TEXT in SQL Server, but apart from the above page we couldn't find any more accurate information. Looks like we'll have to do trial and error to find the valid set. >>> Is there a way to avoid such behavior and force mxODBC to always pass >>> strings as a varchar-type? >> Please check whether you see the same problem when using longer >> strings, e.g. ones with 500 bytes. > > I modified INSERT-line and now I get this result: > > cur.execute("INSERT INTO #test(t) VALUES(?)", ('test\n1234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890123456478901234564789012345647890',)) > Traceback (most recent call last): > File "", line 1, in ? > mx.ODBC.Error.ProgrammingError: ('22018', 206, '[FreeTDS][SQL Server]Operand type clash: image is incompatible with text', 7028) Thanks, so that's not an option either. >> We'll investigate this a bit more and if needed issue a patch >> release to address the problem. We ran a few tests and can confirm the problem using TEXT columns. For some reason, this problem does not occur with VARCHAR(254) columns (which are scheduled to replace TEXT in a future SQL Server release according to MS). Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 14 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From mal at egenix.com Wed May 14 17:15:04 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Wed May 14 16:15:21 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <482AC390.6040206@egenix.com> References: <20080514063712.152350@gmx.net> <482AB288.9050404@egenix.com> <20080514104143.79090@gmx.net> <482AC390.6040206@egenix.com> Message-ID: <482AF3E8.10705@egenix.com> On 2008-05-14 12:48, M.-A. Lemburg wrote: > On 2008-05-14 12:41, Alexandre Pigolkine wrote: >>> We'll investigate this a bit more and if needed issue a patch >>> release to address the problem. > > We ran a few tests and can confirm the problem using TEXT > columns. > > For some reason, this problem does not occur with > VARCHAR(254) columns (which are scheduled to replace TEXT in a > future SQL Server release according to MS). We'll issue a patch release to address this problem. Could you tell us which version of mxODBC you've downloaded (the filename which includes all the necessary details) ? We'll them upload a release candidate, so that you can test whether our fix solves you problem. Thanks, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 14 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From pigolkine at gmx.de Thu May 15 16:35:30 2008 From: pigolkine at gmx.de (Alexandre Pigolkine) Date: Thu May 15 15:35:53 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <482AF3E8.10705@egenix.com> References: <20080514063712.152350@gmx.net> <482AB288.9050404@egenix.com> <20080514104143.79090@gmx.net> <482AC390.6040206@egenix.com> <482AF3E8.10705@egenix.com> Message-ID: <20080515133530.272640@gmx.net> I downloaded this file: egenix-mxodbc-3.0.1.linux-x86_64-py2.4_ucs4.prebuilt.zip Best regards, Alexander Pigolkin -------- Original-Nachricht -------- > Datum: Wed, 14 May 2008 16:15:04 +0200 > Von: "M.-A. Lemburg" > An: Alexandre Pigolkine > CC: egenix-users@egenix.com > Betreff: Re: [egenix-users] Newlines and VARBINARY > On 2008-05-14 12:48, M.-A. Lemburg wrote: > > On 2008-05-14 12:41, Alexandre Pigolkine wrote: > >>> We'll investigate this a bit more and if needed issue a patch > >>> release to address the problem. > > > > We ran a few tests and can confirm the problem using TEXT > > columns. > > > > For some reason, this problem does not occur with > > VARCHAR(254) columns (which are scheduled to replace TEXT in a > > future SQL Server release according to MS). > > We'll issue a patch release to address this problem. > > Could you tell us which version of mxODBC you've downloaded > (the filename which includes all the necessary details) ? > > We'll them upload a release candidate, so that you can test > whether our fix solves you problem. > > Thanks, > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Source (#1, May 14 2008) > >>> Python/Zope Consulting and Support ... http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ > ________________________________________________________________________ > > :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: > > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 From mal at egenix.com Thu May 15 21:47:09 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Thu May 15 20:47:30 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <20080515133530.272640@gmx.net> References: <20080514063712.152350@gmx.net> <482AB288.9050404@egenix.com> <20080514104143.79090@gmx.net> <482AC390.6040206@egenix.com> <482AF3E8.10705@egenix.com> <20080515133530.272640@gmx.net> Message-ID: <482C852D.7020305@egenix.com> On 2008-05-15 15:35, Alexandre Pigolkine wrote: > I downloaded this file: > > egenix-mxodbc-3.0.1.linux-x86_64-py2.4_ucs4.prebuilt.zip Thanks. We've just uploaded the RC2 versions of 3.0.2: http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs2.prebuilt.zip http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs4.prebuilt.zip http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.5_ucs2.prebuilt.zip http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.5_ucs4.prebuilt.zip You existing eval license should work with those as well. The new release will lift the restrictions on TEXT, CHAR and VARCHAR binary column data for SQL Server and a few other backends. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 15 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 > Best regards, > Alexander Pigolkin > > > -------- Original-Nachricht -------- >> Datum: Wed, 14 May 2008 16:15:04 +0200 >> Von: "M.-A. Lemburg" >> An: Alexandre Pigolkine >> CC: egenix-users@egenix.com >> Betreff: Re: [egenix-users] Newlines and VARBINARY > >> On 2008-05-14 12:48, M.-A. Lemburg wrote: >>> On 2008-05-14 12:41, Alexandre Pigolkine wrote: >>>>> We'll investigate this a bit more and if needed issue a patch >>>>> release to address the problem. >>> We ran a few tests and can confirm the problem using TEXT >>> columns. >>> >>> For some reason, this problem does not occur with >>> VARCHAR(254) columns (which are scheduled to replace TEXT in a >>> future SQL Server release according to MS). >> We'll issue a patch release to address this problem. >> >> Could you tell us which version of mxODBC you've downloaded >> (the filename which includes all the necessary details) ? >> >> We'll them upload a release candidate, so that you can test >> whether our fix solves you problem. >> >> Thanks, >> -- >> Marc-Andre Lemburg >> eGenix.com >> >> Professional Python Services directly from the Source (#1, May 14 2008) >> >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >> >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >> >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ >> ________________________________________________________________________ >> >> :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: >> >> >> eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 >> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg >> Registered at Amtsgericht Duesseldorf: HRB 46611 > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > https://www.egenix.com/mailman/listinfo/egenix-users From pigolkine at gmx.de Fri May 16 12:26:28 2008 From: pigolkine at gmx.de (Alexandre Pigolkine) Date: Fri May 16 11:27:05 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <482C852D.7020305@egenix.com> References: <20080514063712.152350@gmx.net> <482AB288.9050404@egenix.com> <20080514104143.79090@gmx.net> <482AC390.6040206@egenix.com> <482AF3E8.10705@egenix.com> <20080515133530.272640@gmx.net> <482C852D.7020305@egenix.com> Message-ID: <20080516092628.248440@gmx.net> I tested this version egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs4.prebuilt.zip and it looks really good. Tabs and new lines were saved and loaded to/from varchar, char and text fields in SQL Server database. Thanks a lot. Best regards, Alexander Pigolkin -------- Original-Nachricht -------- > Datum: Thu, 15 May 2008 20:47:09 +0200 > Von: "M.-A. Lemburg" > An: Alexandre Pigolkine > CC: egenix-users@egenix.com > Betreff: Re: [egenix-users] Newlines and VARBINARY > On 2008-05-15 15:35, Alexandre Pigolkine wrote: > > I downloaded this file: > > > > egenix-mxodbc-3.0.1.linux-x86_64-py2.4_ucs4.prebuilt.zip > > Thanks. > > We've just uploaded the RC2 versions of 3.0.2: > > http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs2.prebuilt.zip > http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs4.prebuilt.zip > http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.5_ucs2.prebuilt.zip > http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.5_ucs4.prebuilt.zip > > You existing eval license should work with those as well. > > The new release will lift the restrictions on TEXT, CHAR and VARCHAR > binary column data for SQL Server and a few other backends. > > Regards, > -- > Marc-Andre Lemburg > eGenix.com > > Professional Python Services directly from the Source (#1, May 15 2008) > >>> Python/Zope Consulting and Support ... http://www.egenix.com/ > >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ > >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ > ________________________________________________________________________ > > :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: > > > eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > Registered at Amtsgericht Duesseldorf: HRB 46611 > > > > Best regards, > > Alexander Pigolkin > > > > > > -------- Original-Nachricht -------- > >> Datum: Wed, 14 May 2008 16:15:04 +0200 > >> Von: "M.-A. Lemburg" > >> An: Alexandre Pigolkine > >> CC: egenix-users@egenix.com > >> Betreff: Re: [egenix-users] Newlines and VARBINARY > > > >> On 2008-05-14 12:48, M.-A. Lemburg wrote: > >>> On 2008-05-14 12:41, Alexandre Pigolkine wrote: > >>>>> We'll investigate this a bit more and if needed issue a patch > >>>>> release to address the problem. > >>> We ran a few tests and can confirm the problem using TEXT > >>> columns. > >>> > >>> For some reason, this problem does not occur with > >>> VARCHAR(254) columns (which are scheduled to replace TEXT in a > >>> future SQL Server release according to MS). > >> We'll issue a patch release to address this problem. > >> > >> Could you tell us which version of mxODBC you've downloaded > >> (the filename which includes all the necessary details) ? > >> > >> We'll them upload a release candidate, so that you can test > >> whether our fix solves you problem. > >> > >> Thanks, > >> -- > >> Marc-Andre Lemburg > >> eGenix.com > >> > >> Professional Python Services directly from the Source (#1, May 14 > 2008) > >> >>> Python/Zope Consulting and Support ... > http://www.egenix.com/ > >> >>> mxODBC.Zope.Database.Adapter ... > http://zope.egenix.com/ > >> >>> mxODBC, mxDateTime, mxTextTools ... > http://python.egenix.com/ > >> > ________________________________________________________________________ > >> > >> :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! > :::: > >> > >> > >> eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 > >> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg > >> Registered at Amtsgericht Duesseldorf: HRB 46611 > > > > > > _______________________________________________________________________ > > eGenix.com User Mailing List http://www.egenix.com/ > > https://www.egenix.com/mailman/listinfo/egenix-users From mal at egenix.com Fri May 16 13:27:57 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Fri May 16 12:28:17 2008 Subject: [egenix-users] Newlines and VARBINARY In-Reply-To: <20080516092628.248440@gmx.net> References: <20080514063712.152350@gmx.net> <482AB288.9050404@egenix.com> <20080514104143.79090@gmx.net> <482AC390.6040206@egenix.com> <482AF3E8.10705@egenix.com> <20080515133530.272640@gmx.net> <482C852D.7020305@egenix.com> <20080516092628.248440@gmx.net> Message-ID: <482D61AD.1010004@egenix.com> On 2008-05-16 11:26, Alexandre Pigolkine wrote: > I tested this version > egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs4.prebuilt.zip > and it looks really good. Tabs and new lines were saved > and loaded to/from varchar, char and text fields in SQL Server database. > > Thanks a lot. Thanks for checking. We will the final 3.0.2 in a couple of days. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 16 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 > Best regards, > Alexander Pigolkin > > -------- Original-Nachricht -------- >> Datum: Thu, 15 May 2008 20:47:09 +0200 >> Von: "M.-A. Lemburg" >> An: Alexandre Pigolkine >> CC: egenix-users@egenix.com >> Betreff: Re: [egenix-users] Newlines and VARBINARY > >> On 2008-05-15 15:35, Alexandre Pigolkine wrote: >>> I downloaded this file: >>> >>> egenix-mxodbc-3.0.1.linux-x86_64-py2.4_ucs4.prebuilt.zip >> Thanks. >> >> We've just uploaded the RC2 versions of 3.0.2: >> >> http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs2.prebuilt.zip >> http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.4_ucs4.prebuilt.zip >> http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.5_ucs2.prebuilt.zip >> http://downloads.egenix.com/python/egenix-mxodbc-3.0.2_rc2.linux-x86_64-py2.5_ucs4.prebuilt.zip >> >> You existing eval license should work with those as well. >> >> The new release will lift the restrictions on TEXT, CHAR and VARCHAR >> binary column data for SQL Server and a few other backends. >> >> Regards, >> -- >> Marc-Andre Lemburg >> eGenix.com >> >> Professional Python Services directly from the Source (#1, May 15 2008) >> >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >> >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >> >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ >> ________________________________________________________________________ >> >> :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: >> >> >> eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 >> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg >> Registered at Amtsgericht Duesseldorf: HRB 46611 >> >> >>> Best regards, >>> Alexander Pigolkin >>> >>> >>> -------- Original-Nachricht -------- >>>> Datum: Wed, 14 May 2008 16:15:04 +0200 >>>> Von: "M.-A. Lemburg" >>>> An: Alexandre Pigolkine >>>> CC: egenix-users@egenix.com >>>> Betreff: Re: [egenix-users] Newlines and VARBINARY >>>> On 2008-05-14 12:48, M.-A. Lemburg wrote: >>>>> On 2008-05-14 12:41, Alexandre Pigolkine wrote: >>>>>>> We'll investigate this a bit more and if needed issue a patch >>>>>>> release to address the problem. >>>>> We ran a few tests and can confirm the problem using TEXT >>>>> columns. >>>>> >>>>> For some reason, this problem does not occur with >>>>> VARCHAR(254) columns (which are scheduled to replace TEXT in a >>>>> future SQL Server release according to MS). >>>> We'll issue a patch release to address this problem. >>>> >>>> Could you tell us which version of mxODBC you've downloaded >>>> (the filename which includes all the necessary details) ? >>>> >>>> We'll them upload a release candidate, so that you can test >>>> whether our fix solves you problem. >>>> >>>> Thanks, >>>> -- >>>> Marc-Andre Lemburg >>>> eGenix.com >>>> >>>> Professional Python Services directly from the Source (#1, May 14 >> 2008) >>>> >>> Python/Zope Consulting and Support ... >> http://www.egenix.com/ >>>> >>> mxODBC.Zope.Database.Adapter ... >> http://zope.egenix.com/ >>>> >>> mxODBC, mxDateTime, mxTextTools ... >> http://python.egenix.com/ >> ________________________________________________________________________ >>>> :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! >> :::: >>>> >>>> eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 >>>> D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg >>>> Registered at Amtsgericht Duesseldorf: HRB 46611 >>> >>> _______________________________________________________________________ >>> eGenix.com User Mailing List http://www.egenix.com/ >>> https://www.egenix.com/mailman/listinfo/egenix-users > > > _______________________________________________________________________ > eGenix.com User Mailing List http://www.egenix.com/ > https://www.egenix.com/mailman/listinfo/egenix-users From cliffq at islandwood.org Wed May 21 22:35:37 2008 From: cliffq at islandwood.org (Cliff Quinn) Date: Thu May 22 06:36:26 2008 Subject: [egenix-users] Still can't install mxODBCZopeDA on plone 3.1.1 buildout Message-ID: <7CD69867FCBA0F4694B0C053BF093313018B49FE@POSTINO.pselc.internal> I've been trying for two weeks and have put a lot of time into trying to get mxodbc running on the above buildout on a Ubuntu 6.06 server on an i686 machine. I'm really frustrated, but must be very close. I have, according to previous instructions found here, done these things in buildout.cfg: In buildout section: [buildout] parts = ... mxodbc ##added src/collective.recipe.mxodbc after downloading from http://svn.plone.org/svn /collective.recipe.mxodbc/ into the src directory develop = src/collective.recipe.mxodbc ##added collective.recipe.mxodbc for the mxodbc egg eggs = ... collective.recipe.mxodbc ##And had to add mxodbc-licenses.zip to the build dir ##added for mxodbc to: [instance] extra-paths = ${mxodbc:location} ##added this part as per http://www.egenix.com/mailman-archives/egenix-users/2008-May/114382.html ##with real key number [mxodbc] recipe = collective.recipe.mxodbc license-key = 0000-0000-0000-0000-0000-0000 ##added for mxodbc [zopepy] extra-paths = ${mxodbc:location} I've downloaded the mxODBCZopeDA package from your site, and put it in the buildout/products directory. This seems to all compile ok when I run bin/buildout, but when I run the site I get the following error message: ... File "Products/mxODBCZopeDA/ZopeDA.py", line 246, in find_subpackages ImportError: no usable mxODBC subpackage found: iODBC: libiodbc.so.2: cannot open shared object file: No such file or directory; unixODBC: initialization of module mxODBC failed (mx.ODBC.unixODBC.LicenseError:mx.ODBC.license is not a license for product version 3.0.1) There is a license.py and.txt in the parts/mxodbc/mx/ODBC apparently placed there by the buildout Can you please help me figure this out - I've spent waay too much time on this. Cliff ____________________________________________________ Cliff Quinn, IT Manager IslandWood 4450 Blakely Avenue NE Bainbridge Island WA 98110 206.855.4300 www.IslandWood.org The mission of IslandWood is to provide exceptional learning experiences and to inspire lifelong environmental and community stewardship. -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20080521/6c082ec1/attachment.htm From mj at zopatista.com Thu May 22 12:17:20 2008 From: mj at zopatista.com (Martijn Pieters) Date: Thu May 22 11:18:16 2008 Subject: [egenix-users] Still can't install mxODBCZopeDA on plone 3.1.1 buildout In-Reply-To: <7CD69867FCBA0F4694B0C053BF093313018B49FE@POSTINO.pselc.internal> References: <7CD69867FCBA0F4694B0C053BF093313018B49FE@POSTINO.pselc.internal> Message-ID: <21a6ef160805220217s609220dw9aec8facc3396e7@mail.gmail.com> On Thu, May 22, 2008 at 6:35 AM, Cliff Quinn wrote: > I've downloaded the mxODBCZopeDA package from your site, and put it in the > buildout/products directory. Alternatively you could use the plone.recipe.distros for this (usually the section is already there, look for [productdistros], add the download url to the urls option). This has nothing to do with your problem, however. > This seems to all compile ok when I run bin/buildout, but when I run the > site I get the following error message: > > ? > > File "Products/mxODBCZopeDA/ZopeDA.py", line 246, in find_subpackages > > ImportError: no usable mxODBC subpackage found: iODBC: libiodbc.so.2: cannot > open shared object file: No such file or directory; unixODBC: initialization > of module mxODBC failed (mx.ODBC.unixODBC.LicenseError:mx.ODBC.license is > not a license for product version 3.0.1) > > There is a license.py and.txt in the parts/mxodbc/mx/ODBC apparently placed > there by the buildout Indeed, the recipe places them there from the zip file, but it doesn't do any sanity checking on them. The license header should read something like: -------------------------------------------------------------------- PRODUCT: mxODBC - Python ODBC Interface -------------------------------------------------------------------- VERSION: 3.0 -------------------------------------------------------------------- LICENSE: 1 CPU License for one (1) CPU That's from the docstring in license.py. Other than that, I have no idea how to troubleshoot this. -- Martijn Pieters From mal at egenix.com Thu May 22 13:13:19 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Thu May 22 12:13:46 2008 Subject: [egenix-users] Still can't install mxODBCZopeDA on plone 3.1.1 buildout In-Reply-To: <7CD69867FCBA0F4694B0C053BF093313018B49FE@POSTINO.pselc.internal> References: <7CD69867FCBA0F4694B0C053BF093313018B49FE@POSTINO.pselc.internal> Message-ID: <4835473F.4050000@egenix.com> On 2008-05-22 06:35, Cliff Quinn wrote: > I've been trying for two weeks and have put a lot of time into trying to > get mxodbc running on the above buildout on a Ubuntu 6.06 server on an > i686 machine. I'm really frustrated, but must be very close. Have you tried installing the mxODBC Zope DA as per the standard instructions in the manual using the simple unzip product installation procedure ? Or is there a reason you have to use buildout for this ? > ... > > This seems to all compile ok when I run bin/buildout, but when I run the > site I get the following error message: > > ... > > File "Products/mxODBCZopeDA/ZopeDA.py", line 246, in find_subpackages > > ImportError: no usable mxODBC subpackage found: iODBC: libiodbc.so.2: > cannot open shared object file: No such file or directory; unixODBC: > initialization of module mxODBC failed > (mx.ODBC.unixODBC.LicenseError:mx.ODBC.license is not a license for > product version 3.0.1) The above basically says that: * you don't have iODBC installed (which is fine - you only need one ODBC manager installed) * you do have unixODBC installed, but the mxODBC Zope DA picks up the wrong mx/ package directory Note that mxODBC Zope DA ships with mxODBC 2.1. You get the above license message in case you have installed the stand-alone egenix-mxodbc distribution as well - which you shouldn't, since the Zope DA already comes with everything you need to run the DA (ie. egenix-mx-base and egenix-mxodbc). > There is a license.py and.txt in the parts/mxodbc/mx/ODBC apparently > placed there by the buildout > > > > Can you please help me figure this out - I've spent waay too much time > on this. I'm really sorry that you're having so much trouble in getting zc.buildout to work. I've had another look at Martijn's buildbot recipe: http://svn.plone.org/svn/collective/buildout/collective.recipe.mxodbc/trunk/collective/recipe/mxodbc/__init__.py It turns out that the recipe addresses a different use case: The recipe installs the *stand-alone* mxODBC version (and corresponding license). This can be used in Zope and Plone just fine, but doesn't include the mxODBC Zope DA that you are trying to install. The Zope DA product is packaged in egenix-mxodbc-zopeda and comes with everything you need to run the Zope DA. Please do try the standard installation procedure first. It is really easy to get a Zope 2 product installed using that approach. If you do need to use buildout, you should be able to add the mxODBC Zope DA product using the approach described here for Zope 2 products: http://plone.org/documentation/tutorial/buildout/installing-a-third-party-product There's only one catch to this: because our products still support Zope versions prior to Zope 2.7 (which changed the layout of Zope products), there is a directory move step in the installation which buildout will probably have trouble with. You may need to recreate an archive from the ones you download from our site, that includes the moved product directory to make it work with plone.recipe.distros recipe. It should also be possible to write Plone recipe specifically for the mxODBC Zope DA, using Martijn's recipe as basis. For the next release of the Zope DA, we'll change the layout to make it a drop-in installation again and also look into providing eggs. Hopefully, that makes using it with buildout easier. I'm sorry, but we cannot change the layout of the Zope DA 1.0 release since we have existing customers who rely on it. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 22 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 From etyrer at york.cuny.edu Thu May 22 11:49:47 2008 From: etyrer at york.cuny.edu (Eric S Tyrer II) Date: Thu May 22 16:50:54 2008 Subject: [egenix-users] Plone 3.1, Buildout, and MX ODBC Zope DA Message-ID: <61D7F8C0-3A2D-4A41-AF26-3076E620CE39@york.cuny.edu> Cliff If you are using the collective.recipe from svn you are going to drive yourself nuts... It took me 2 weeks to figure out that that recipe is just for the python mx product. We need Zope version. here's what i did and it is working great. not sure where you are at: make sure that you have Unix ODBC installed and functioning. download the MX ODBC Zope DA product from engenix. Make sure you use the correct version UC 2 or 4. license file has to be placed within /opt/Plone-3.1/zeocluster/ as mxodbc-licenses.zip Unzip it in any directory. move the mx folder to your src directory under /opt/Plone-3.1/zeocluster/src Under Zopey I added the following. (Zopey = zope instance's python interpreter located at /opt/Plone-3.1/Python-2.4/bin/python) extra-paths = ${zope2:location}/lib/python src/mx This way python can find the mx parts to function. Now move mxODBCZopeDA folder to the products folder. Make sure permissions on all files are the same as you plone user (guessing chown -R plone:plone *) restart zeo/zope etc and check you products setup in the control panel looking for mxODBCZopeDA & mx (not sure if that shows up) or look at the page of your database connection in the zmi. hope that helps.. Regards Eric Tyrer ---- Eric S. Tyrer II Web Systems Manager York College | The City University of New York 94-20 Guy R. Brewer Blvd.- Academic Core - STE 1H14 Jamaica, NY 11451 (P) 718-262-2466 (C) 347-393-6507 Be a yardstick of quality. Some people aren't used to an environment where excellence is expected. - Steven P. Jobs Dimidium facti qui coepit habet; sapere aude; incipe ! - Quintus Horatius Flaccus (Horace) -------------- next part -------------- An HTML attachment was scrubbed... URL: /mailman-archives/egenix-users/attachments/20080522/48b7a500/attachment.htm From mal at egenix.com Thu May 22 22:03:35 2008 From: mal at egenix.com (M.-A. Lemburg) Date: Thu May 22 21:04:01 2008 Subject: [egenix-users] Still can't install mxODBCZopeDA on plone 3.1.1 buildout In-Reply-To: <7CD69867FCBA0F4694B0C053BF093313018B4A0C@POSTINO.pselc.internal> References: <7CD69867FCBA0F4694B0C053BF093313018B49FE@POSTINO.pselc.internal> <4835473F.4050000@egenix.com> <7CD69867FCBA0F4694B0C053BF093313018B4A0C@POSTINO.pselc.internal> Message-ID: <4835C387.6040203@egenix.com> On 2008-05-22 19:24, Cliff Quinn wrote: > Thanks for the response. You're right that I have been using the > buildout recipe to install mxodbc in my Plone. I just thought that if it > was installed I could just drop the ZopeDA into products and it would > work fine. > > I had also tried installing mx-base and mxodbc using the standalone > installation procedure from your site (without using the buildout). I > assumed they would be compatible with the ZopeDA and tried it this way > but got the same error. > > So I now have managed to get the DA installed into Zope - bypassing the > buildout part entirely and manually copying the mx folder from the zip > (which includes the mx-base installation) to > /usr/lib/python2.4/site-packages > > Are the licenses I have not acceptable in the current mxodbc? The mxODBC Zope DA licenses will only work with the Zope DA, not the stand-alone mxODBC version. However, the Zope DA does provide a regular Python interface as well and unlike the stand-alone version, this interface is integrated into the Zope transaction system. Sorry again, for all the trouble. Regards, -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, May 22 2008) >>> Python/Zope Consulting and Support ... http://www.egenix.com/ >>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ >>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/ ________________________________________________________________________ :::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! :::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611