Skip to content

flexget seen search crashes when piping #1407

@harleypig

Description

@harleypig

Expected behaviour:

Get results of search piped to a file.

Actual behaviour:

flexget crashes with "codec can't encode character error"

Steps to reproduce:

flexget seen search 'pattern' | tee somefile
flexget seen search 'pattern' > somefile

Config:

No relevant config.

Log:

No log output is produced.

Additional information:

  • Flexget Version: 2.3.27.dev
  • Python Version: 2.7.12
  • Installation method: git
  • OS and version: Linux Mint 17 Kernel 3.19.3-031903-lowlatency
  • Link to crash log:
$ bin/flexget seen search 'tv_' | tee ~/work/test ; bin/flexget seen search 'tv_' --porcelain | tee ~/work/test ; bin/flexget seen search 'tv_' > ~/work/test ; bin/flexget seen search 'tv_' --porcelain > ~/work/test
Could not start manager: 'ascii' codec can't encode character u'\xf1' in position 1183797: ordinal not in range(128)
Could not start manager: 'ascii' codec can't encode character u'\xf1' in position 1182978: ordinal not in range(128)
Could not start manager: 'ascii' codec can't encode character u'\xf1' in position 1183797: ordinal not in range(128)
Could not start manager: 'ascii' codec can't encode character u'\xf1' in position 1182978: ordinal not in range(128)

The same results occur with --porcelain.

This appears to be related to #1223, but the fix there does not work. However, the following change does work. I don't know what problems this may cause though.

$ git diff
 diff --git a/flexget/terminal.py b/flexget/terminal.py
 index 22a819c..b3bb4d2 100644
 --- a/flexget/terminal.py
 +++ b/flexget/terminal.py
 @@ -257,6 +257,7 @@ def console(text, *args, **kwargs):
      try:
          print(text, *args, **kwargs)
      except UnicodeEncodeError:
 -        text = text.encode(io_encoding, 'replace').decode(io_encoding)
 +        #text = text.encode(io_encoding, 'replace').decode(io_encoding)
 +        text = text.encode(io_encoding, 'replace')
          print(text, *args, **kwargs)
      kwargs['file'].flush()  # flush to make sure the output is printed right away

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions