openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #00745
Re: Windows Installer
On 12/14/2011 12:23 PM, contact@xxxxxxxxxxxxxxx wrote:
> Then why does the code which is working in Ubuntu is not working on
> Windows. The code which is breaking is
>
> pur_yr = datetime.strptime(asset.date_of_purchase,'%Y-%m-%d').year
>
> works fine on Ubuntu 11 (Python 2.7 running on it)
If it works, it must be for another reason. Here is an example on Ubuntu
11.10, python 2.7:
>>> import datetime,sys
>>> sys.version
'2.7.2+ (default, Oct 4 2011, 20:06:09) \n[GCC 4.6.1]'
>>> datetime.datetime.strptime('2011-10-11 00:00:00','%Y-%m-%d')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/_strptime.py", line 328, in _strptime
data_string[found.end():])
ValueError: unconverted data remains: 00:00:00
>>> datetime.datetime.strptime('2011-10-11 00:00:00',
... '%Y-%m-%d %H:%M:%S')
datetime.datetime(2011, 10, 11, 0, 0)
>>>
As you can see, the behavior of strptime is as expected on Python 2.7 as
well.
> The same code on Windows (with Python 2.5 came along with OpenERP
> installation) does not work, gives following error
>
> Traceback (most recent call last):
> File "netsvc.pyo", line 489, in dispatch
> File "service\web_services.pyo", line 599, in dispatch
> File "osv\osv.pyo", line 122, in wrapper
> File "osv\osv.pyo", line 176, in execute
> File "osv\osv.pyo", line 167, in execute_cr
> File "C:\Program Files (x86)\OpenERP
> 6.0\Server\addons\Fixed_Assets\fixed_assets.py", line 302, in
> compute_depreciation
> File "C:\Program Files (x86)\OpenERP
> 6.0\Server\addons\Fixed_Assets\fixed_assets.py", line 211, in
> _cal_deprciation
> File "_strptime.pyo", line 333, in strptime
> ValueError: unconverted data remains: 00:00:00
Perhaps that's an error in the module you are using. What does
`asset.date_of_purchase` really return in Windows, and in Ubuntu?
To make things simpler, is there somewhere we can read the exact source
code of the module you are using?
Cheers,
PS: please keep the list in Cc so this thread can be useful for others
in the future