regebro / tzlocal

A Python module that tries to figure out what your local timezone is

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnicodeEncodeError: 'ascii' codec can't encode character

mansoor17syed opened this issue · comments

Hi Team,

Facing below issue when running the below cmd. Requesting you to please help me fixing it.
cd python36-tzlocal-4.2; python3 setup.py bdist_rpm --spec-only --release=date +.el7

      running bdist_rpm
      /usr/local/lib/python3.6/site-packages/setuptools/command/bdist_rpm.py:20: SetuptoolsDeprecationWarning: bdist_rpm is deprecated and will be removed in a future version. Use bdist_wheel (wheel packages) instead.
        SetuptoolsDeprecationWarning,
      running egg_info
      writing tzlocal.egg-info/PKG-INFO
      writing dependency_links to tzlocal.egg-info/dependency_links.txt
      writing requirements to tzlocal.egg-info/requires.txt
      writing top-level names to tzlocal.egg-info/top_level.txt
      reading manifest file 'tzlocal.egg-info/SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      adding license file 'LICENSE.txt'
      writing manifest file 'tzlocal.egg-info/SOURCES.txt'
      writing 'dist/tzlocal.spec'
      Traceback (most recent call last):
        File "setup.py", line 3, in <module>
          setup()
        File "/usr/local/lib/python3.6/site-packages/setuptools/__init__.py", line 153, in setup
          return distutils.core.setup(**attrs)
        File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
          dist.run_commands()
        File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
          self.run_command(cmd)
        File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
          cmd_obj.run()
        File "/usr/local/lib/python3.6/site-packages/setuptools/command/bdist_rpm.py", line 26, in run
          orig.bdist_rpm.run(self)
        File "/usr/lib64/python3.6/distutils/command/bdist_rpm.py", line 283, in run
          "writing '%s'" % spec_path)
        File "/usr/lib64/python3.6/distutils/cmd.py", line 335, in execute
          util.execute(func, args, msg, dry_run=self.dry_run)
        File "/usr/lib64/python3.6/distutils/util.py", line 301, in execute
          func(*args)
        File "/usr/lib64/python3.6/distutils/file_util.py", line 236, in write_file
          f.write(line + "\n")
      UnicodeEncodeError: 'ascii' codec can't encode character '\xeb' in position 4385: ordinal not in range(128)

Version-python36-tzlocal-4.2

The issue seems to be with the OS and environment.
If explicitly the LANG is set I dint seem to see the issue. Below is my solution
env LANG=en_US.UTF-8 python3 setup.py bdist_rpm --spec-only --release=date +.el7