Timestamp code assumes st_mtime int, is float in python 2.5
"Vincent Castellano" <[email protected]>
| Newsgroups | gmane.comp.mobile.bitpim.devel |
|---|---|
| Message-ID | <[email protected]> |
Hello,
In fileview.py, on line 147, the code reads 'if v is not None and not
isinstance(v, int):'. This is a problem as timestamps are now floats
in python. This brings up the question, should bitpim be explicitly
type checking? I would think v = int(v) would be sufficient, as if it
is an incompatible datatype, it will simply raise an exception, and
bitpim handles that just fine.
If you'd prefer not to make such a change, at least consider the
attached patch, which just adds Python 2.5 with a low impacte change.
If there is a better method, I'm all for it, I would just like Python
2.5 compatibility.
Thank you,
Vincent Castellano
P.S.
The currently raised error is TypeError('duration property is an int
arg'). Why does this say duration, when it seems to be a file
timestamp?
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
BitPim-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bitpim-devel
bitpim-py25mtimes.patch
(application/octet-stream, 533 B)
--- fileview.py.orig 2007-07-25 21:49:07.000000000 -0700
+++ fileview.py 2007-07-25 21:59:01.000000000 -0700
@@ -144,7 +144,7 @@
def _get_timestamp(self):
return self._data.get('timestamp', None)
def _set_timestamp(self, v):
- if v is not None and not isinstance(v, int):
+ if v is not None and not isinstance(v, (int, float)):
raise TypeError('duration property is an int arg')
self._set_or_del('timestamp', v)
timestamp=property(fget=_get_timestamp, fset=_set_timestamp)