Migrate 3 to 4 Errors

Hello everyone, I’ve installed bench on an existing v3 install of ERPNext. Now when I run bench migrate-3to4, the following exception is thrown

scanbech@erp:~/frappe-bench$ bench migrate-3to4 /home/scanbech/erpnext-bench
/home/scanbech/erpnext-bench/public
database backup taken - sites/erpnext-bench/private/backups/20150119_65939290_database.sql.gz - on
Traceback (most recent call last):
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 106, in <module>
    main(args.site)
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 39, in main
    migrate(site)
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 79, in migrate
    validate(site)
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 70, in validate
    backup()
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/cli.py", line 68, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/cli.py", line 499, in backup
    print "database backup taken -", odb.backup_path_db, "- on", now()
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 92, in now
    return now_datetime().strftime('%Y-%m-%d %H:%M:%S.%f')
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 66, in now_datetime
    return convert_utc_to_user_timezone(datetime.datetime.utcnow())
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 82, in convert_utc_to_user_timezone
    return utcnow.astimezone(timezone(get_user_time_zone()))
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 70, in get_user_time_zone
    frappe.local.user_time_zone = frappe.cache().get_value("time_zone")
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/memc.py", line 19, in get_value
    val = self.get(self.n(key))
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/memc.py", line 10, in n
    return (frappe.conf.db_name + ":" + key.replace(" ", "_")).encode('utf-8')
TypeError: unsupported operand type(s) for +: 'NoneType' and 'unicode'
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/scanbech/bench-repo/bench/cli.py", line 38, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/scanbech/bench-repo/bench/cli.py", line 201, in migrate_3to4
    site=path))
  File "/home/scanbech/bench-repo/bench/utils.py", line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'env/bin/python /home/scanbech/bench-repo/bench/migrate3to4.py /home/scanbech/erpnext-bench' returned non-zero exit status 1

is the path to your v3 setup “/home/scanbech/erpnext-bench”? it should a dir with directories, lib and app

scanbech@erp:~/erpnext-bench$ ls
apps    env   Procfile   scripts  standard_apps.json
config  logs  Readme.md  sites    templates

Now if I should navigate deep I equally get this

scanbech@erp:~/frappe-bench$ bench migrate-3to4 /home/scanbech/erpnext-bench/apps/erpnext/erpnext
/home/scanbech/erpnext-bench/apps/erpnext/erpnext/public
database backup taken - sites/erpnext/private/backups/20150120_38821332_database.sql.gz - on
Traceback (most recent call last):
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 106, in <module>
    main(args.site)
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 39, in main
    migrate(site)
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 79, in migrate
    validate(site)
  File "/home/scanbech/bench-repo/bench/migrate3to4.py", line 70, in validate
    backup()
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/cli.py", line 68, in new_fn
    return fn(*args, **new_kwargs)
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/cli.py", line 499, in backup
    print "database backup taken -", odb.backup_path_db, "- on", now()
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 92, in now
    return now_datetime().strftime('%Y-%m-%d %H:%M:%S.%f')
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 66, in now_datetime
    return convert_utc_to_user_timezone(datetime.datetime.utcnow())
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 82, in convert_utc_to_user_timezone
    return utcnow.astimezone(timezone(get_user_time_zone()))
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/utils/data.py", line 70, in get_user_time_zone
    frappe.local.user_time_zone = frappe.cache().get_value("time_zone")
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/memc.py", line 19, in get_value
    val = self.get(self.n(key))
  File "/home/scanbech/frappe-bench/apps/frappe/frappe/memc.py", line 10, in n
    return (frappe.conf.db_name + ":" + key.replace(" ", "_")).encode('utf-8')
TypeError: unsupported operand type(s) for +: 'NoneType' and 'unicode'
Error: None
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 9, in <module>
    load_entry_point('bench==0.1', 'console_scripts', 'bench')()
  File "/home/scanbech/bench-repo/bench/cli.py", line 38, in cli
    return bench()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 610, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 590, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 936, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 782, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 416, in invoke
    return callback(*args, **kwargs)
  File "/home/scanbech/bench-repo/bench/cli.py", line 201, in migrate_3to4
    site=path))
  File "/home/scanbech/bench-repo/bench/utils.py", line 61, in exec_cmd
    subprocess.check_call(cmd, cwd=cwd, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'env/bin/python /home/scanbech/bench-repo/bench/migrate3to4.py /home/scanbech/erpnext-bench/apps/erpnext/erpnext' returned non-zero exit status 1


scanbech@erp:~/erpnext-bench/apps/erpnext$ ls
CONTRIBUTING.md  erpnext.egg-info  MANIFEST.in  requirements.txt  test_sites
erpnext          license.txt       README.md    setup.py

scanbech@erp:~/erpnext-bench/apps/erpnext/erpnext$ ls
accounts     home          manufacturing  public   support       __version__.py
buying       hooks.py      modules.txt    selling  templates
config       hr            patches        setup    tests
contacts     __init__.py   patches.txt    startup  translations
controllers  __init__.pyc  projects       stock    utilities

You’re not on version 3 but on an old bench of version 4.

remove the frappe-bench dir and follow the steps here, https://github.com/frappe/bench/wiki/Migrating-from-old-bench