I18n_fastgenerate error reading unicode file name

Hi,
I’m trying to modify some translations and when I run:

paver i18n_fastgenerate

I get this error:

Traceback (most recent call last):
  File "/openedx/venv/bin/i18n_tool", line 11, in <module>
    sys.exit(main())
  File "/openedx/venv/local/lib/python2.7/site-packages/i18n/main.py", line 60, in main
    return module.main()
  File "/openedx/venv/local/lib/python2.7/site-packages/i18n/__init__.py", line 51, in __call__
    return self.run(args)
  File "/openedx/venv/local/lib/python2.7/site-packages/i18n/generate.py", line 189, in run
    execute(compile_cmd, working_directory=configuration.root_dir, stderr=stderr)
  File "/openedx/venv/local/lib/python2.7/site-packages/i18n/execute.py", line 21, in execute
    sp.check_call(command, cwd=working_directory, stderr=stderr, shell=True)
  File "/usr/lib/python2.7/subprocess.py", line 541, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'django-admin.py compilemessages -v0' returned non-zero exit status 1

I was digging a little bit and I know that if I run:

django-admin compilemessages -v 3

I get this error:

Traceback (most recent call last):
  File "/openedx/venv/bin/django-admin", line 11, in <module>
    sys.exit(execute_from_command_line())
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "/openedx/venv/local/lib/python2.7/site-packages/django/core/management/commands/compilemessages.py", line 70, in handle
    for dirpath, dirnames, filenames in os.walk('.', topdown=True):
  File "/openedx/venv/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/openedx/venv/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/openedx/venv/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/openedx/venv/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/openedx/venv/lib/python2.7/os.py", line 296, in walk
    for x in walk(new_path, topdown, onerror, followlinks):
  File "/openedx/venv/lib/python2.7/os.py", line 286, in walk
    if isdir(join(top, name)):
  File "/openedx/venv/lib/python2.7/posixpath.py", line 74, in join
    path += '/' + b
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 1: ordinal not in range(128)

The problems seem to be when is processing the folder:

./common/test/data/test_unicode/tabs

That folder contains a file with a unicode character in its name.

I checked the edx-platform/conf/locale/config.yaml and I see a this configuration:

ignore_dirs:
    - common/static/xmodule/modules
    - common/static/xmodule/descriptors
    # Directories with no user-facing code.
    - '*/migrations'
    - '*/envs'
    # Directories that are not our code.
    - node_modules
    # Directories containing files that can't have strings in them.
    - conf
    - docs
    - '*/fonts'
    - '*/img'
    - '*/images'
    - '*/sass'
    - '*/css'
    # Directories that only contain tests.
    - common/test

It appears that is ignoring the ignored folders config value…

How can I fix this?
Thanks in advance!

Juan

2 Likes

@juangarias Can you check your environment variables? You might have LC_ALL=ascii defined.

3 Likes

Hi Ned,
Great! That did the trick.
The envinronment variable wasnt defined.
After I did export LC_ALL="en_US.UTF-8", it worked fine.

Thanks!
Juan

2 Likes