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

Packages that contains Unicode character failed on install/release #927

Closed
davidlatwe opened this issue Aug 9, 2020 · 0 comments
Closed

Comments

@davidlatwe
Copy link
Contributor

Problem

A package that contains Unicode characters, for example, someone's name in authors which auto collected from git, will not be able to install nor release.

Invoking custom build system...
Traceback (most recent call last):
  File "C:\Python36_64\Lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Python36_64\Lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\david\rez\core\Scripts\rez\rez-build.exe\__main__.py", line 7, in <module>
  File "c:\users\david\rez\core\lib\site-packages\rez\cli\_entry_points.py", line 110, in run_rez_build
    return run("build")
  File "c:\users\david\rez\core\lib\site-packages\rez\cli\_main.py", line 160, in run
    returncode = run_cmd()
  File "c:\users\david\rez\core\lib\site-packages\rez\cli\_main.py", line 152, in run_cmd
    return func(opts, opts.parser, extra_arg_groups)
  File "c:\users\david\rez\core\lib\site-packages\rez\cli\build.py", line 157, in command
    variants=opts.variants)
  File "c:\users\david\rez\core\lib\site-packages\rezplugins\build_process\local.py", line 53, in build
    install=install)
  File "c:\users\david\rez\core\lib\site-packages\rez\build_process.py", line 204, in visit_variants
    result = func(variant, **kwargs)
  File "c:\users\david\rez\core\lib\site-packages\rezplugins\build_process\local.py", line 359, in _build_variant
    variant.install(install_path)
  File "c:\users\david\rez\core\lib\site-packages\rez\packages.py", line 449, in install
    overrides=overrides)
  File "c:\users\david\rez\core\lib\site-packages\rezplugins\package_repository\filesystem.py", line 722, in install_variant
    variant = _create_variant()
  File "c:\users\david\rez\core\lib\site-packages\rezplugins\package_repository\filesystem.py", line 715, in _create_variant
    overrides=overrides
  File "c:\users\david\rez\core\lib\site-packages\rezplugins\package_repository\filesystem.py", line 1190, in _create_variant
    dump_package_data(package_data, buf=f, format_=package_format)
  File "C:\Python36_64\Lib\contextlib.py", line 88, in __exit__
    next(self.gen)
  File "c:\users\david\rez\core\lib\site-packages\rez\serialise.py", line 72, in open_file_for_write
    f.write(content)
UnicodeEncodeError: 'cp950' codec can't encode character '\u263a' in position 82: illegal multibyte sequence

Cause

The UnicodeEncodeError was firstly raised from here
https://github.com/nerdvegas/rez/blob/def201aca819862470b879d5beb75fcf3d46f87f/src/rez/serialise.py#L71
And here is the next stop that would raise the same error
https://github.com/nerdvegas/rez/blob/def201aca819862470b879d5beb75fcf3d46f87f/src/rez/serialise.py#L88

By adding kwarg encoding="utf-8" resolved the problem for me, will try submit a PY2 compatible PR for this.

nerdvegas added a commit that referenced this issue Aug 11, 2020
…-failed

Fix #927, add encoding=utf-8 on file write
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant