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

Illegal character in create_dconfig_from_params #8239

Closed
hyui3434 opened this issue Nov 1, 2024 · 2 comments · Fixed by #8240
Closed

Illegal character in create_dconfig_from_params #8239

hyui3434 opened this issue Nov 1, 2024 · 2 comments · Fixed by #8240
Assignees
Milestone

Comments

@hyui3434
Copy link

hyui3434 commented Nov 1, 2024

Hi! I was using Tribler and THIS happened! 😢

Traceback (most recent call last):
  File "D:\a\tribler\tribler\src\tribler\core\restapi\rest_manager.py", line 107, in error_middleware
  File "D:\a\tribler\tribler\src\tribler\core\restapi\rest_manager.py", line 162, in required_components_middleware
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\aiohttp\web_middlewares.py", line 117, in impl
  File "D:\a\tribler\tribler\src\tribler\core\libtorrent\restapi\downloads_endpoint.py", line 428, in add_download
  File "D:\a\tribler\tribler\src\tribler\core\libtorrent\restapi\downloads_endpoint.py", line 106, in create_dconfig_from_params
  File "D:\a\tribler\tribler\src\tribler\core\libtorrent\download_manager\download_config.py", line 132, in from_defaults
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\configobj\__init__.py", line 2108, in write
UnicodeEncodeError: 'ascii' codec can't encode character '\u044f' in position 20: ordinal not in range(128)

@qstokkink qstokkink changed the title d Illegal character in create_dconfig_from_params Nov 1, 2024
@qstokkink qstokkink added this to the 8.0.4 milestone Nov 1, 2024
@qstokkink
Copy link
Contributor

Thanks for the report. I can reproduce this.

Reproduction

  1. Create a new directory with Cyrillic characters. I used the directory ыц я бое! хыюи щертыфор щертыфор.
  2. Set the TSTATEDIR environment variable to that new directory.
  3. Launch Tribler and start a download.

Effects

When clicking a download, there is a vague error:

screenshot

The first error appears in the error reporter:

Traceback (most recent call last):
  File "\tribler\src\tribler\core\restapi\rest_manager.py", line 107, in error_middleware
    response = await handler(request)
  File "\tribler\src\tribler\core\restapi\rest_manager.py", line 162, in required_components_middleware
    return await handler(request)
  File "\tribler\venv\lib\site-packages\aiohttp\web_middlewares.py", line 114, in impl
    return await handler(request)
  File "\tribler\src\tribler\core\libtorrent\restapi\torrentinfo_endpoint.py", line 202, in get_torrent_info
    metainfo = await self.download_manager.get_metainfo(infohash, timeout=60, hops=i_hops, url=uri)
  File "\tribler\src\tribler\core\libtorrent\download_manager\download_manager.py", line 551, in get_metainfo
    dcfg = DownloadConfig.from_defaults(self.config)
  File "\tribler\src\tribler\core\libtorrent\download_manager\download_config.py", line 132, in from_defaults
    defaults.write(spec_file)
  File "\tribler\venv\lib\site-packages\configobj\__init__.py", line 2117, in write
    output_bytes = output.encode(self.encoding or
UnicodeEncodeError: 'ascii' codec can't encode characters in position 35-36: ordinal not in range(128)

If you click "Download" anyway, you get the second error of OP:

Traceback (most recent call last):
  File "\tribler\src\tribler\core\restapi\rest_manager.py", line 107, in error_middleware
    response = await handler(request)
  File "\tribler\src\tribler\core\restapi\rest_manager.py", line 162, in required_components_middleware
    return await handler(request)
  File "\tribler\venv\lib\site-packages\aiohttp\web_middlewares.py", line 114, in impl
    return await handler(request)
  File "\tribler\src\tribler\core\libtorrent\restapi\downloads_endpoint.py", line 428, in add_download
    download_config, error = self.create_dconfig_from_params(params)
  File "\tribler\src\tribler\core\libtorrent\restapi\downloads_endpoint.py", line 106, in create_dconfig_from_params
    download_config = DownloadConfig.from_defaults(self.download_manager.config)
  File "\tribler\src\tribler\core\libtorrent\download_manager\download_config.py", line 132, in from_defaults
    defaults.write(spec_file)
  File "\tribler\venv\lib\site-packages\configobj\__init__.py", line 2117, in write
    output_bytes = output.encode(self.encoding or
UnicodeEncodeError: 'ascii' codec can't encode characters in position 35-36: ordinal not in range(128)

@qstokkink
Copy link
Contributor

This should be fixed in the upcoming 8.0.4 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants