novoid/Memacs

AttributeError: type object 'OrgFormat' has no attribute 'datetime' - after ubuntu update

Closed this issue · 3 comments

ajft commented

Following a two-stage upgrade of my linux box from 18.04 to 19.04 to 19.10, now whenever I run any of the memacs scripts (which have all been in place & running for years) they all fail with the above error about OrgFormat.

memacs is uptodate from github, in ~/src/memacs. With PYTHONPATH=/home/ajft/src/memacs,, as it has been for months or years, I get the following errors:
$ ~/src/memacs/bin/memacs_lastfm.py -a -c ~/.config/memacs/memacs-lastfm.ini
--output-format "{artist} -- {title}" -o ./lastfm.org_archive

Traceback (most recent call last):
File "/home/ubuntu/src/memacs/memacs/lib/memacs.py", line 187, in handle_main
self._main()
File "/home/ubuntu/src/memacs/memacs/lastfm.py", line 83, in _main
self._handle_recent_tracks(user.get_recent_tracks(limit=100))
File "/home/ubuntu/src/memacs/memacs/lastfm.py", line 57, in _handle_recent_tracks
self._writer.write_org_subitem(timestamp=OrgFormat.datetime(timestamp),
AttributeError: type object 'OrgFormat' has no attribute 'datetime'
Traceback (most recent call last):
File "/home/ubuntu/src/memacs/bin/memacs_lastfm.py", line 27, in
memacs.handle_main()
File "/home/ubuntu/src/memacs/memacs/lib/memacs.py", line 187, in handle_main
self._main()
File "/home/ubuntu/src/memacs/memacs/lastfm.py", line 83, in _main
self._handle_recent_tracks(user.get_recent_tracks(limit=100))
File "/home/ubuntu/src/memacs/memacs/lastfm.py", line 57, in _handle_recent_tracks
self._writer.write_org_subitem(timestamp=OrgFormat.datetime(timestamp),
AttributeError: type object 'OrgFormat' has no attribute 'datetime'

Oh boy, you had the unfortunate bad luck to update and run Memacs within the couple of hours I was busy migrating the orgformat.py to a separate repository: https://github.com/novoid/orgformat

During refactoring the library, the function OrgFormat.datetime([...]) got replaced by OrgFormat.date([...], show_time=True).

I guess with the latest versions of Memacs and orgformat, you should be fine. If not, please do reopen this issue.

ajft commented

yes, all working now. Many thanks (hope this doesn't reopen this issue)

Sorry again for that fuzz.
I was thinking about it but could not find a solution to prevent that situation while I had to test the distributed orgformat in parallel to adapt Memacs/lazyblorg for it. So I made it as quick as possible. ;-)