modoboa / modoboa-imap-migration

An extension to ease the migration between 2 IMAP servers using offlineimap
ISC License
16 stars 12 forks source link

offlineimap.py missing django-urls in python2.7 #56

Closed Tr4sK closed 1 year ago

Tr4sK commented 4 years ago

Hey, I’m trying to setup this migration tool wich can be really useful Here is the error I get when I try to use offlineimap

vmail@mail:~$ offlineimap 
OfflineIMAP 7.2.3
  Licensed under the GNU GPL v2 or any later version (with an OpenSSL exception)
imaplib2 v2.57 (system), Python v2.7.16, OpenSSL 1.1.1d  10 Sep 2019
ERROR: No module named urls
ERROR: Exceptions occurred during the run!
ERROR: No module named urls

Some input

.offlineimap.py

import os
import site
import sys

site.addsitedir("/srv/modoboa/env/lib/python2.7/site-packages")
sys.path.append("/srv/modoboa/instance")
os.environ["DJANGO_SETTINGS_MODULE"] = "instance.settings"

from django.apps import apps
from django.conf import settings
apps.populate(settings.INSTALLED_APPS)

from modoboa_imap_migration.models import Migration

def get_user_password(username):
    """Retrieve a password from Modoboa's database."""
    return Migration.objects.select_related().get(
        mailbox__user__username=username
    ).password

~.offlineimaprc

[general]
accounts = XXX@YYY
pythonfile = ~/.offlineimap.py

[Account XXX@YYY]
localrepository = Local_XXX@YYY
remoterepository = Remote_XXX@YYY

[Repository Local_XXX@YYY]
type = IMAP
ssl = false
remotehost = localhost
remoteuser = XXX@YYY
remotepasseval = get_user_password("XXX@YYY")

[Repository Remote_XXX@YYY]
type = IMAP
remotehost = ssl0.ovh.net
remoteport = 993

ssl = yes
sslcacertfile = /etc/ssl/certs/ca-certificates.crt

remoteuser = XXX@YYY
remotepasseval = get_user_password("XXX@YYY")
readonly = true
(env) modoboa@mail:~$ pip install django-urls
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting django-urls
  Using cached https://files.pythonhosted.org/packages/85/2e/d9fd07d8e500a19f5158990884eec6bf6a76935b849ea9c23ad79de4f331/django_urls-1.0.3.tar.gz
ERROR: Could not find a version that satisfies the requirement django>=2.0 (from django-urls) (from versions: 1.1.3, 1.1.4, 1.2, 1.2.1, 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6, 1.2.7, 1.3, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.4, 1.4.1, 1.4.2, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 1.4.7, 1.4.8, 1.4.9, 1.4.10, 1.4.11, 1.4.12, 1.4.13, 1.4.14, 1.4.15, 1.4.16, 1.4.17, 1.4.18, 1.4.19, 1.4.20, 1.4.21, 1.4.22, 1.5, 1.5.1, 1.5.2, 1.5.3, 1.5.4, 1.5.5, 1.5.6, 1.5.7, 1.5.8, 1.5.9, 1.5.10, 1.5.11, 1.5.12, 1.6, 1.6.1, 1.6.2, 1.6.3, 1.6.4, 1.6.5, 1.6.6, 1.6.7, 1.6.8, 1.6.9, 1.6.10, 1.6.11, 1.7, 1.7.1, 1.7.2, 1.7.3, 1.7.4, 1.7.5, 1.7.6, 1.7.7, 1.7.8, 1.7.9, 1.7.10, 1.7.11, 1.8a1, 1.8b1, 1.8b2, 1.8rc1, 1.8, 1.8.1, 1.8.2, 1.8.3, 1.8.4, 1.8.5, 1.8.6, 1.8.7, 1.8.8, 1.8.9, 1.8.10, 1.8.11, 1.8.12, 1.8.13, 1.8.14, 1.8.15, 1.8.16, 1.8.17, 1.8.18, 1.8.19, 1.9a1, 1.9b1, 1.9rc1, 1.9rc2, 1.9, 1.9.1, 1.9.2, 1.9.3, 1.9.4, 1.9.5, 1.9.6, 1.9.7, 1.9.8, 1.9.9, 1.9.10, 1.9.11, 1.9.12, 1.9.13, 1.10a1, 1.10b1, 1.10rc1, 1.10, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.11a1, 1.11b1, 1.11rc1, 1.11, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.11.6, 1.11.7, 1.11.8, 1.11.9, 1.11.10, 1.11.11, 1.11.12, 1.11.13, 1.11.14, 1.11.15, 1.11.16, 1.11.17, 1.11.18, 1.11.20, 1.11.21, 1.11.22, 1.11.23, 1.11.24, 1.11.25)
ERROR: No matching distribution found for django>=2.0 (from django-urls)
(env) modoboa@mail:~$ pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package                         Version  
------------------------------- ---------
backports.csv                   1.0.7    
bcrypt                          3.1.4    
certifi                         2019.9.11
cffi                            1.13.1   
chardet                         3.0.4    
Click                           7.0      
coreapi                         2.3.3    
coreapi-cli                     1.0.6    
coreschema                      0.0.4    
cryptography                    2.8      
dj-database-url                 0.5.0    
Django                          1.11.25  
django-braces                   1.11.0   
django-ckeditor                 5.2.2    
django-compat                   1.0.15   
django-filter                   1.1.0    
django-reversion                2.0.12   
django-subcommand2              0.1.1    
django-webpack-loader           0.6.0    
django-xforwardedfor-middleware 2.0      
djangorestframework             3.7.3    
dnspython                       1.15.0   
enum34                          1.1.6    
feedparser                      5.2.1    
future                          0.18.1   
futures                         3.3.0    
gevent                          1.4.0    
greenlet                        0.4.15   
html2text                       2019.8.11
idna                            2.8      
ipaddress                       1.0.23   
itypes                          1.1.0    
Jinja2                          2.10.3   
jsonfield                       2.0.2    
LEPL                            5.1.3    
lxml                            4.4.1    
MarkupSafe                      1.1.1    
modoboa                         1.14.0   
modoboa-admin                   1.1.2    
modoboa-amavis                  1.2.3    
modoboa-dmarc                   1.1.0    
modoboa-imap-migration          1.3.3    
modoboa-postfix-autoreply       1.5.1    
modoboa-sievefilters            1.4.2    
modoboa-stats                   1.4.1    
modoboa-webmail                 1.5.0    
passlib                         1.7.1    
Pillow                          6.2.1    
pip                             19.3.1   
pkg-resources                   0.0.0    
progressbar-latest              2.4      
progressbar33                   2.4      
psycopg2                        2.8.4    
py-dateutil                     2.2      
pycparser                       2.19     
pytz                            2019.3   
requests                        2.22.0   
requests-file                   1.4.3    
rfc6266                         0.0.4    
rrdtool                         0.1.15   
setuptools                      41.4.0   
sievelib                        1.1.1    
six                             1.12.0   
tldextract                      2.2.2    
uritemplate                     3.0.0    
urllib3                         1.25.6   
wheel                           0.33.6   
root@mail:/srv/vmail# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 10 (buster)
Release:    10
Codename:   buster