timecode icon indicating copy to clipboard operation
timecode copied to clipboard

[pip install timecode] UnicodeDecodeError: 'cp950' codec can't decode byte 0xc3 in position 9097: illegal multibyte sequence

Open FlyDogDaDa opened this issue 1 year ago • 1 comments

I try pip install timecode, but I get encoding errors.

(.venv) D:\.....\.venv\Scripts>pip install timecode
Collecting timecode
  Using cached timecode-1.4.0.tar.gz (43 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [18 lines of output]
      Traceback (most recent call last):
        File "d:\.....\.venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "d:\.....\.venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "d:\.....\.venv\lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "D:\TEMP\pip-build-env-m_q5666t\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "D:\TEMP\pip-build-env-m_q5666t\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
          self.run_setup()
        File "D:\TEMP\pip-build-env-m_q5666t\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
          super().run_setup(setup_script=setup_script)
        File "D:\TEMP\pip-build-env-m_q5666t\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 25, in <module>
        File "<string>", line 18, in read_file
      UnicodeDecodeError: 'cp950' codec can't decode byte 0xc3 in position 9097: illegal multibyte sequence
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

I tried to modify the installation program to make it run normally, but I failed. I am not very good at python, sorry.

FlyDogDaDa avatar May 15 '24 06:05 FlyDogDaDa

I edited the encoding of setup.py and then called pip install timecode-master

def read_file(file_path):
    """Read the given file at file_path.

    Args:
        file_path (str): The file path to read.

    Returns:
        str: The file content.
    """
    with open(file_path, encoding="utf-8") as f:
        data = f.read()
    return data

It works for me. The installation was successful. I hope it can be updated to the default installation method in the future.

FlyDogDaDa avatar May 15 '24 07:05 FlyDogDaDa