<DKIM> nametrans and lambda function

Jethro Tull heavytull at hotmail.com
Sat Jan 21 21:58:15 GMT 2017

On Sat, 21 Jan, 2017,  1:22:04 +0100, Nicolas Sebrecht wrote:
> On Fri, Jan 20, 2017 at 09:15:16PM +0000, Jethro Tull wrote:
> > offlineimap v. 7.0.8
> There have been changes around nametrans since v7.0.8. Please, update to
> the current v7.0.12 stable release.
I updated and tried, ... nothing has changed.

> > I'm using a function, "pathsubs()", loaded through a pythonfile for nametrans.
> > This function will return the local folder name to be synced with the given
> > remote folder through the variable folder_r. For debugging purpose this
> > variable is set by default to the only remote folder I'm interested in.
> > 
> > Here are the key settings about the problem from my offlineimap configuration: 
> > folderfilter = lambda foldername: foldername in [ '[Gmail]/Sent Mail' ] 
> > nametrans = lambda folder: pathsubs( folder_r = folder )
> nametrans = pathsubs(folder)
are you sure this is a possibility??
I had tried it previously, it was so worse ...

I'm not too sure about the philosophy of python, and about handling functions.
Since doing like this made offlineimap crashing even without having prompted
for my login password I though it might be due to something regarding python
language rather than offlineimap so I prefered not talk about that in my
previous email. Here is the output:

$ offlineimap --dry-run -c .offlineimaprc/offlineimap.conf    [84/386]
OfflineIMAP 7.0.12
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
Thread 'Account sync gmail' terminated with exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/offlineimap/threadutil.py", line 160, in ru
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 263, in sync
    self.remoterepos = Repository(self, 'remote')
  File "/usr/lib/python2.7/site-packages/offlineimap/repository/__init__.py", line 8
4, in __new__
    return repo(name, account)
  File "/usr/lib/python2.7/site-packages/offlineimap/repository/IMAP.py", line 37, i
n __init__
    BaseRepository.__init__(self, reposname, account)
  File "/usr/lib/python2.7/site-packages/offlineimap/repository/Base.py", line 55, i
n __init__
    self.getconf('nametrans'), {'re': re})
  File "/usr/lib/python2.7/site-packages/offlineimap/localeval.py", line 48, in eval
    return eval(text, names)
  File "<string>", line 1, in <module>
NameError: name 'folder' is not defined

Last 1 debug messages logged for Account sync gmail prior to exception:
thread: Register new thread 'Account sync gmail' (account 'gmail')

That's really strange, don't you have a working example of nametrans?
[ ... ]
> -- 
> Nicolas Sebrecht

More information about the OfflineIMAP-project mailing list