docker-zulip icon indicating copy to clipboard operation
docker-zulip copied to clipboard

Import fails with UnicodeEncodeError

Open rlora opened this issue 3 years ago • 1 comments

Hello,

I'm trying to migrate a realm from a server to new docker based environment. This was the first issue I've run into (there are others I might submit as different issues).

When importing data exception is raised when moving uploaded files UnicodeEncodeError.

To fix this exception I've had to manually export LANG=C.UTF-8 and was able to continue. When logging in as zulip I've used su - zulip, this always worked on other environments. But the container seems to have LANG empty for the user.

Is it expected to work with su - zulip? Or should we use just su.

Thanks,

Traceback (most recent call last):
  File "./manage.py", line 50, in <module>
    execute_from_command_line(sys.argv)
  File "/home/zulip/deployments/2020-07-31-00-02-57/zulip-py3-venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility.execute()
  File "/home/zulip/deployments/2020-07-31-00-02-57/zulip-py3-venv/lib/python3.6/site-packages/django/core/management/__init__.py", line 375, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/zulip/deployments/2020-07-31-00-02-57/zulip-py3-venv/lib/python3.6/site-packages/django/core/management/base.py", line 323, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/zulip/deployments/2020-07-31-00-02-57/zulip-py3-venv/lib/python3.6/site-packages/django/core/management/base.py", line 364, in execute
    output = self.handle(*args, **options)
  File "/home/zulip/deployments/2020-07-31-00-02-57/zerver/management/commands/import.py", line 78, in handle
    realm = do_import_realm(path, subdomain, num_processes)
  File "/home/zulip/deployments/2020-07-31-00-02-57/zerver/lib/import_realm.py", line 1032, in do_import_realm
    import_uploads(realm, os.path.join(import_dir, "uploads"), processes)
  File "/home/zulip/deployments/2020-07-31-00-02-57/zerver/lib/import_realm.py", line 722, in import_uploads
    shutil.copy(orig_file_path, file_path)
  File "/usr/lib/python3.6/shutil.py", line 243, in copy
    if os.path.isdir(dst):
  File "/usr/lib/python3.6/genericpath.py", line 42, in isdir
    st = os.stat(s)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf1' in position 71: ordinal not in range(128)

rlora avatar Aug 30 '20 00:08 rlora

Thanks for the report! It seems like this probably should work, yeah.

@andersk FYI.

timabbott avatar Aug 31 '20 01:08 timabbott