Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to create imap folder structure manually #417

Closed
darnir opened this Issue Nov 30, 2016 · 5 comments

Comments

Projects
None yet
3 participants
@darnir
Copy link
Member

darnir commented Nov 30, 2016

General informations

  • system/distribution (with version):
  • offlineimap version (offlineimap -V):
  • Python version:
  • server name or domain:
  • CLI options:

I know it used to in the past, but when setting up a new machine with Offlineimap, I have the issue that offlineimap will not create the required directories. If I create the directory structure manually, offlineimap will continue and download the files as required

Logs, error

OfflineIMAP 7.0.11
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
*** Processing account darnirmlist
Establishing connection to imap.gmail.com:993 (darnirmlist-remote)
ERROR: getfolder() asked for a nonexisting folder 'Arch Linux'.
*** Finished account 'darnirmlist' in 0:01
ERROR: Exceptions occurred during the run!
ERROR: getfolder() asked for a nonexisting folder 'Arch Linux'.

Traceback:
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 278, in syncrunner
    self.__sync()
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 372, in __sync
    localfolder = self.get_local_folder(remotefolder)
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 307, in get_local_folder
    replace(self.remoterepos.getsep(), self.localrepos.getsep()))
  File "/usr/lib/python2.7/site-packages/offlineimap/repository/Maildir.py", line 149, in getfolder
    "folder '%s'."% foldername, OfflineImapError.ERROR.FOLDER)

After this, I manually create the directory "Arch Linux" at the required location using:

mkdir ~/.local/var/lib/mail/darnirmlist/Arch\ Linux/{new,tmp,cur}

Then, offlineimap gives the following error:

OfflineIMAP 7.0.11
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
*** Processing account darnirmlist
Establishing connection to imap.gmail.com:993 (darnirmlist-remote)
Creating new Local Status db for darnirmlist-local:Arch Linux
Syncing Arch Linux: Gmail -> GmailMaildir
Collecting data from messages on Arch Linux
Collecting data from messages on Arch Linux
ERROR: getfolder() asked for a nonexisting folder 'Arch Linux.arch-announce'.
*** Finished account 'darnirmlist' in 0:01
ERROR: Exceptions occurred during the run!
ERROR: getfolder() asked for a nonexisting folder 'Arch Linux.arch-announce'.

Traceback:
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 278, in syncrunner
    self.__sync()
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 372, in __sync
    localfolder = self.get_local_folder(remotefolder)
  File "/usr/lib/python2.7/site-packages/offlineimap/accounts.py", line 307, in get_local_folder
    replace(self.remoterepos.getsep(), self.localrepos.getsep()))
  File "/usr/lib/python2.7/site-packages/offlineimap/repository/Maildir.py", line 149, in getfolder
    "folder '%s'."% foldername, OfflineImapError.ERROR.FOLDER)

Upon following all the errors and creating the entire directory structure manually, I can get offlineimap to start synchronizing my mails

@nicolas33 nicolas33 added the bug label Nov 30, 2016

@nicolas33

This comment has been minimized.

Copy link
Member

nicolas33 commented Nov 30, 2016

Please, share your configuration file.

@darnir

This comment has been minimized.

Copy link
Member Author

darnir commented Nov 30, 2016

Configuration file:

[general]

metadata = $XDG_DATA_HOME/offlineimap
accounts = darnirmlist
maxsyncaccounts = 1
ui = basic
pythonfile = $XDG_DATA_HOME/offlineimap/passkey.py

socktimeout = 20
fsync = false

[DEFAULT]
localrepositoryhome = ~/.local/var/lib/mail

[Account darnirmlist]
localrepository = darnirmlist-local
remoterepository = darnirmlist-remote
status_backend = sqlite
autorefresh = 1
quick = 20
synclabels = yes
ignorelabels = \Inbox, \Starred, \Sent, \Draft, \Spam, \Trash, \Important

[Repository darnirmlist-local]
type = GmailMaildir
localfolders = %(localrepositoryhome)s/darnirmlist

[Repository darnirmlist-remote]
type = Gmail
remoteuser = darnirmlist@gmail.com

auth_mechanisms = XOAUTH2
oauth2_client_id_eval = get_client_id('darnirmlist@gmail.com')
oauth2_client_secret_eval = get_client_secret('darnirmlist@gmail.com')
oauth2_refresh_token_eval = get_refresh_token('darnirmlist@gmail.com')
oauth2_request_url = https://accounts.google.com/o/oauth2/token
nametrans = lambda folder: re.sub('.*Spam$', 'Spam',
                           re.sub('.*INBOX$', 'Inbox',
                           re.sub('.*Drafts$', 'Drafts',
                           re.sub('.*Sent Mail$', 'Sent',
                           re.sub('.*All Mail', 'Archive',
                           re.sub('.*Trash$', 'Trash', folder))))))
folderfilter = lambda foldername: foldername not in ['[Gmail]/All Mail',
                                                     '[Gmail]/Drafts',
                                                     '[Gmail]/Sent Mail',
                                                     '[Gmail]/Spam']
createfolders = False
sslcacertfile = /etc/ssl/certs/ca-certificates.crt
realdelete = no
holdconnectionopen = yes
keepalive = 50

aroig added a commit to aroig/offlineimap that referenced this issue Nov 30, 2016

aroig added a commit to aroig/offlineimap that referenced this issue Nov 30, 2016

repository: Base: fix typo in folder variable name
Probably fixes OfflineIMAP#417.

Signed-off-by: Abdo Roig-Maranges <abdo.roig@gmail.com>
@aroig

This comment has been minimized.

Copy link
Member

aroig commented Nov 30, 2016

@darnir #419 should fix it.

@nicolas33 nicolas33 closed this in 9148648 Nov 30, 2016

@nicolas33

This comment has been minimized.

Copy link
Member

nicolas33 commented Nov 30, 2016

I'm assuming this is fixed because I do think it is. If not, feel free to let us know.
Closing.

@darnir

This comment has been minimized.

Copy link
Member Author

darnir commented Nov 30, 2016

I've already manually created the required directory structure. However, it does seem like the issue should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.