question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`sort_by` can't handle fields with colons

See original GitHub issue

Expected behaviour:

Properly sort entries from RSS feed with custom fields

Actual behaviour:

Crash

Config:

  test:
    mock:
      - title: "[Flexget] Amazing Show - s01e01"
        "colons:field": 123
    sort_by:
      - field: "colons:field"

Log:

(click to expand)
2022-01-08 15:14:02 VERBOSE  details       test            Produced 1 entries.
2022-01-08 15:14:02 CRITICAL task          test            BUG: Unhandled error in plugin sort_by: chunk after expression
Traceback (most recent call last):

  File "c:\python37\Lib\threading.py", line 890, in _bootstrap
    self._bootstrap_inner()
    β”‚    β”” <function Thread._bootstrap_inner at 0x000001470EB78318>
    β”” <Thread(task_queue, started daemon 2736)>

  File "c:\python37\Lib\threading.py", line 926, in _bootstrap_inner
    self.run()
    β”‚    β”” <function Thread.run at 0x000001470EB780D8>
    β”” <Thread(task_queue, started daemon 2736)>

  File "c:\python37\Lib\threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
    β”‚    β”‚        β”‚    β”‚        β”‚    β”” {}
    β”‚    β”‚        β”‚    β”‚        β”” <Thread(task_queue, started daemon 2736)>
    β”‚    β”‚        β”‚    β”” ()
    β”‚    β”‚        β”” <Thread(task_queue, started daemon 2736)>
    β”‚    β”” <bound method TaskQueue.run of <flexget.task_queue.TaskQueue object at 0x0000014716646AC8>>
    β”” <Thread(task_queue, started daemon 2736)>

  File "c:\users\brutuz\documents\github\flexget\flexget\task_queue.py", line 47, in run
    self.current_task.execute()
    β”‚    β”‚            β”” <function Task.execute at 0x0000014711B049D8>
    β”‚    β”” <flexget.task.Task object at 0x00000147168AB208>
    β”” <flexget.task_queue.TaskQueue object at 0x0000014716646AC8>

  File "c:\users\brutuz\documents\github\flexget\flexget\task.py", line 87, in wrapper
    return func(self, *args, **kw)
           β”‚    β”‚      β”‚       β”” {}
           β”‚    β”‚      β”” ()
           β”‚    β”” <flexget.task.Task object at 0x00000147168AB208>
           β”” <function Task.execute at 0x0000014711B04948>

  File "c:\users\brutuz\documents\github\flexget\flexget\task.py", line 727, in execute
    self._execute()
    β”‚    β”” <function Task._execute at 0x0000014711B048B8>
    β”” <flexget.task.Task object at 0x00000147168AB208>

  File "c:\users\brutuz\documents\github\flexget\flexget\task.py", line 696, in _execute
    self.__run_task_phase(phase)
    β”‚                     β”” 'filter'
    β”” <flexget.task.Task object at 0x00000147168AB208>

  File "c:\users\brutuz\documents\github\flexget\flexget\task.py", line 514, in __run_task_phase
    response = self.__run_plugin(plugin, phase, args)
               β”‚                 β”‚       β”‚      β”” (<flexget.task.Task object at 0x00000147168AB208>, [{'field': 'colons:field'}])
               β”‚                 β”‚       β”” 'filter'
               β”‚                 β”” <PluginInfo(name=sort_by)>
               β”” <flexget.task.Task object at 0x00000147168AB208>

> File "c:\users\brutuz\documents\github\flexget\flexget\task.py", line 547, in __run_plugin
    result = method(*args, **kwargs)
             β”‚       β”‚       β”” {}
             β”‚       β”” (<flexget.task.Task object at 0x00000147168AB208>, [{'field': 'colons:field'}])
             β”” <Event(name=plugin.sort_by.filter,func=on_task_filter,priority=255)>

  File "c:\users\brutuz\documents\github\flexget\flexget\event.py", line 20, in __call__
    return self.func(*args, **kwargs)
           β”‚    β”‚     β”‚       β”” {}
           β”‚    β”‚     β”” (<flexget.task.Task object at 0x00000147168AB208>, [{'field': 'colons:field'}])
           β”‚    β”” <bound method PluginSortBy.on_task_filter of <flexget.plugins.modify.sort_by.PluginSortBy object at 0x000001471585D8C8>>
           β”” <Event(name=plugin.sort_by.filter,func=on_task_filter,priority=255)>

  File "c:\users\brutuz\documents\github\flexget\flexget\plugins\modify\sort_by.py", line 85, in on_task_filter
    task.all_entries.sort(key=sort_key, reverse=reverse)
    β”‚    β”‚                    β”‚                 β”” False
    β”‚    β”‚                    β”” <function PluginSortBy.on_task_filter.<locals>.sort_key at 0x0000014716938C18>
    β”‚    β”” <property object at 0x0000014711B039F8>
    β”” <flexget.task.Task object at 0x00000147168AB208>

  File "c:\users\brutuz\documents\github\flexget\flexget\plugins\modify\sort_by.py", line 79, in sort_key
    val = evaluate_expression(field, entry)
          β”‚                   β”‚      β”” <Entry(title=[Flexget] Amazing Show - s01e01,state=undecided)>
          β”‚                   β”” 'colons:field'
          β”” <function evaluate_expression at 0x00000147117404C8>

  File "c:\users\brutuz\documents\github\flexget\flexget\utils\template.py", line 345, in evaluate_expression
    compiled_expr = environment.compile_expression(expression)
                    β”‚           β”‚                  β”” 'colons:field'
                    β”‚           β”” <function Environment.compile_expression at 0x00000147116C95E8>
                    β”” <flexget.utils.template.FlexGetEnvironment object at 0x00000147166CAEC8>

  File "c:\users\brutuz\documents\github\flexget\lib\site-packages\jinja2\environment.py", line 798, in compile_expression
    self.handle_exception(source=source)
    β”‚    β”‚                       β”” 'colons:field'
    β”‚    β”” <function Environment.handle_exception at 0x00000147116C9798>
    β”” <flexget.utils.template.FlexGetEnvironment object at 0x00000147166CAEC8>

  File "c:\users\brutuz\documents\github\flexget\lib\site-packages\jinja2\environment.py", line 925, in handle_exception
    raise rewrite_traceback_stack(source=source)
          β”‚                              β”” 'colons:field'
          β”” <function rewrite_traceback_stack at 0x0000014716953438>

  File "<unknown>", line 1, in template

jinja2.exceptions.TemplateSyntaxError: chunk after expression

Additional information:

  • FlexGet version: latest
  • Python version: 3.7
  • Installation method: git
  • Using daemon (yes/no): yes
  • OS and version: W10
  • Link to crash log: xxx

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
gazpachokingcommented, Jan 9, 2022

Yeah, that is underdocumented… I added a bit to the wiki about that.

0reactions
BrutuZcommented, Jan 9, 2022

Both worked apparently. Would never have guessed those from https://flexget.com/Plugins/rss πŸ˜…

Read more comments on GitHub >

github_iconTop Results From Across the Web

SORTBY function - Microsoft Support
Learn about the SORTBY function, which sorts the contents of a range or array based on the values ... SORTBY is in a...
Read more >
lodash multi-column sortBy - javascript - Stack Overflow
No. You cannot specify the sort order other than by a callback function that inverses the value. Not even this is possible for...
Read more >
Collection sortBy() on multiple fields #11 - laravel/ideas - GitHub
I had to conjure a ->sort() to do 2 columns that included eager loads. Now I have to do another ->sort() for 2...
Read more >
We cannot sort the 'A' column by 'B'. You cant have more than
Have you got this error while trying to sort columns ?:"We cannot ... Choose a different column for sorting or update the data...
Read more >
[Power BI] Sort By Column And Issues That May Arise - YouTube
Text fields in Power BI are sorted alphabetically by default. What if this ordering doesn't make ... Your browser can't play this video....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found