From: Roberto M. <ro...@cn...> - 2017-11-30 08:35:49
|
Hi, Modify file: pyworkflow/object.py replace class String by: class String(Scalar): """String object. """ DATETIME_FORMAT = "%Y-%m-%d %H:%M:%S" FS = ".%f" # Fento seconds def _convertValue(self, value): return str(value) def empty(self): """ Return true if None or len == 0 """ if not self.hasValue(): return True return len(self.get().strip()) == 0 def datetime(self, formatStr=None, fs=True): """ Get the datetime from the string value. Params: formatStr: if is None, use the default DATETIME_FORMAT. fs: Use femto seconds or not, only when format=None """ if formatStr is None: try: formatStr = self.DATETIME_FORMAT if fs: formatStr += self.FS datetime = dt.datetime.strptime(self._objValue, formatStr) except Exception as ex: # Maybe the %f (femtoseconds) is not working # let's try to format without it datetime = dt.datetime.strptime(self._objValue, self.DATETIME_FORMAT) else: datetime = dt.datetime.strptime(self._objValue, formatStr) return datetime Hope this helps On Wed, Nov 29, 2017 at 10:35 AM, Dmitry A. Semchonok <sem...@gm...> wrote: > Dear colleagues, > > It is probably the common error when you use 2 different rely on versions > > Is there an easy fix for that? > > > time data '2017-11-03 23:17:36' does not match format '%Y-%m-%d %H:%M:%S.%f' > > > Thank you! > > > Sincerely, > > Dmitry > > > > > |