<DKIM> nametrans and lambda function

Nicolas Sebrecht nicolas.s-dev at laposte.net
Sat Jan 21 00:22:04 UTC 2017


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'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)

> For these settings offlineimap does not work properly and says:
>  ERROR: While attempting to sync account 'gmail'
>   descriptor 'lower' requires a 'str' object but received a 'NoneType'
>  *** Finished account 'gmail' in 0:08
> ERROR: Exceptions occurred during the run!
> ERROR: While attempting to sync account 'gmail'
>   descriptor 'lower' requires a 'str' object but received a 'NoneType'
> 
> It should be noted that pathsubs() will return without any value if folder_r is
> set wrongly. As the error says a 'NoneType' was received it might be that
> folder_r was indeed wrongly set.
> 
> If I do not specify any parameter to pathsubs offlineimap works well as
> expected. Here are the corresponding settings:
> folderfilter = lambda foldername: foldername in [ '[Gmail]/Sent Mail' ] 
> nametrans = lambda folder: pathsubs()
> 
> In the pythonfile pathsubs is set with folder_r = '[Gmail]/Sent Mail' and the
> local folder to be synced with is set as 'sent'. The variable localfolders in the
> offlineimap config file is set to '~/gmail'. Working as expected means that
> offlineimap does indeed sync only '[Gmail]/Sent Mail' with '~/gmail/sent' which
> means both folderfilter and nametrans worked fine.

-- 
Nicolas Sebrecht



More information about the OfflineIMAP-project mailing list