Name option no longer works
See original GitHub issueDescribe the bug Name option no longer works
Expected behavior check should pass with the name option set
Environment (please complete the following information):
- OS: Garuda Linux
- Output of
organize --version
: organize, version 2.2.0
Your config file
# organize configuration file
# https://organize.readthedocs.io
rules:
- name: Scripts
- locations:
- path: ~/
filters:
- extension:
- sh
actions:
- move:
dest: ~/Scripts/
Log
organize check
Checking: /home/zany130/.config/organize/config.yaml
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/lib/python3.10/site-packages/schema.py:405 in validate โ
โ โ
โ 402 โ โ โ โ โ โ โ โ skey.handler(nkey, data, e) โ
โ 403 โ โ โ โ โ โ โ else: โ
โ 404 โ โ โ โ โ โ โ โ try: โ
โ โฑ 405 โ โ โ โ โ โ โ โ โ nvalue = Schema(svalue, error=e, ignore_extra_keys=i โ
โ 406 โ โ โ โ โ โ โ โ except SchemaError as x: โ
โ 407 โ โ โ โ โ โ โ โ โ k = "Key '%s' error:" % nkey โ
โ 408 โ โ โ โ โ โ โ โ โ message = self._prepend_schema_name(k) โ
โ โ
โ /usr/lib/python3.10/site-packages/schema.py:366 in validate โ
โ โ
โ 363 โ โ if flavor == ITERABLE: โ
โ 364 โ โ โ data = Schema(type(s), error=e).validate(data, **kwargs) โ
โ 365 โ โ โ o = Or(*s, error=e, schema=Schema, ignore_extra_keys=i) โ
โ โฑ 366 โ โ โ return type(data)(o.validate(d, **kwargs) for d in data) โ
โ 367 โ โ if flavor == DICT: โ
โ 368 โ โ โ exitstack = ExitStack() โ
โ 369 โ โ โ data = Schema(dict, error=e).validate(data, **kwargs) โ
โ โ
โ /usr/lib/python3.10/site-packages/schema.py:366 in <genexpr> โ
โ โ
โ 363 โ โ if flavor == ITERABLE: โ
โ 364 โ โ โ data = Schema(type(s), error=e).validate(data, **kwargs) โ
โ 365 โ โ โ o = Or(*s, error=e, schema=Schema, ignore_extra_keys=i) โ
โ โฑ 366 โ โ โ return type(data)(o.validate(d, **kwargs) for d in data) โ
โ 367 โ โ if flavor == DICT: โ
โ 368 โ โ โ exitstack = ExitStack() โ
โ 369 โ โ โ data = Schema(dict, error=e).validate(data, **kwargs) โ
โ โ
โ /usr/lib/python3.10/site-packages/schema.py:167 in validate โ
โ โ
โ 164 โ โ โ except SchemaError as _x: โ
โ 165 โ โ โ โ autos += _x.autos โ
โ 166 โ โ โ โ errors += _x.errors โ
โ โฑ 167 โ โ raise SchemaError( โ
โ 168 โ โ โ ["%r did not validate %r" % (self, data)] + autos, โ
โ 169 โ โ โ [self._error.format(data) if self._error else None] + errors, โ
โ 170 โ โ ) โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
SchemaError: Or({Optional('name'): <class 'str'>, Optional('enabled'): <class 'bool'>, Optional('subfolders'): <class 'bool'>, Optional('filter_mode'): Or('all', 'any', 'none'), Optional('tags'): Or(<class 'str'>,
[<class 'str'>]), Optional('targets'): Or('dirs', 'files'), 'locations': Or(<class 'str'>, [Or(<class 'str'>, {'path': And(<class 'str'>, <built-in function len>), Optional('max_depth'): Or(<class 'int'>, None),
Optional('search'): Or('depth', 'breadth'), Optional('exclude_files'): Or(<class 'str'>, [<class 'str'>]), Optional('exclude_dirs'): Or(<class 'str'>, [<class 'str'>]), Optional('system_exclude_files'): Or(<class
'str'>, [<class 'str'>]), Optional('system_exclude_dirs'): Or(<class 'str'>, [<class 'str'>]), Optional('filter'): Or(<class 'str'>, [<class 'str'>]), Optional('filter_dirs'): Or(<class 'str'>, [<class 'str'>]),
Optional('ignore_errors'): <class 'bool'>, Optional('filesystem'): <class 'object'>})]), Optional('filters'): [Optional(Or(Schema(Or('not created', 'created')), {Schema(Or('not created', 'created')):
{Optional('mode'): Or('older', 'newer'), Optional('years'): <class 'int'>, Optional('months'): <class 'int'>, Optional('weeks'): <class 'int'>, Optional('days'): <class 'int'>, Optional('hours'): <class 'int'>,
Optional('minutes'): <class 'int'>, Optional('seconds'): <class 'int'>}})), Optional(Or(Schema(Or('not date_added', 'date_added')), {Schema(Or('not date_added', 'date_added')): {Optional('mode'): Or('older',
'newer'), Optional('years'): <class 'int'>, Optional('months'): <class 'int'>, Optional('weeks'): <class 'int'>, Optional('days'): <class 'int'>, Optional('hours'): <class 'int'>, Optional('minutes'): <class
'int'>, Optional('seconds'): <class 'int'>}})), Optional(Or(Schema(Or('not duplicate', 'duplicate')), {Schema(Or('not duplicate', 'duplicate')): Or(<class 'str'>, [<class 'str'>], Schema({}))})),
Optional(Schema(Or('not empty', 'empty'))), Optional(Or(Schema(Or('not exif', 'exif')), {Schema(Or('not exif', 'exif')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not extension',
'extension')), {Schema(Or('not extension', 'extension')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not filecontent', 'filecontent')), {Schema(Or('not filecontent', 'filecontent')):
Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not hash', 'hash')), {Schema(Or('not hash', 'hash')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not name',
'name')), {Schema(Or('not name', 'name')): Or(<class 'str'>, {Optional('match'): <class 'str'>, Optional('startswith'): Or(<class 'str'>, [<class 'str'>]), Optional('contains'): Or(<class 'str'>, [<class 'str'>]),
Optional('endswith'): Or(<class 'str'>, [<class 'str'>]), Optional('case_sensitive'): <class 'bool'>})})), Optional(Or(Schema(Or('not size', 'size')), {Schema(Or('not size', 'size')): Or(<class 'object'>, [<class
'object'>])})), Optional(Or(Schema(Or('not lastmodified', 'lastmodified')), {Schema(Or('not lastmodified', 'lastmodified')): {Optional('mode'): Or('older', 'newer'), Optional('years'): <class 'int'>,
Optional('months'): <class 'int'>, Optional('weeks'): <class 'int'>, Optional('days'): <class 'int'>, Optional('hours'): <class 'int'>, Optional('minutes'): <class 'int'>, Optional('seconds'): <class 'int'>}})),
Optional(Or(Schema(Or('not mimetype', 'mimetype')), {Schema(Or('not mimetype', 'mimetype')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional({Schema(Or('not python', 'python')): Or(<class 'str'>,
{'code': <class 'str'>})}), Optional({Schema(Or('not regex', 'regex')): <class 'str'>})], 'actions': [Optional(Or('confirm', {'confirm': Or(<class 'str'>, {Optional('msg'): <class 'str'>, Optional('default'):
<class 'bool'>})})), Optional({'copy': Or(<class 'str'>, {'dest': <class 'str'>, Optional('on_conflict'): Or('skip', 'overwrite', 'trash', 'rename_new', 'rename_existing'), Optional('rename_template'): <class
'str'>, Optional('filesystem'): <class 'object'>})}), Optional('delete'), Optional({'echo': <class 'str'>}), Optional({'macos_tags': Or(<class 'str'>, [<class 'str'>])}), Optional({'move': Or(<class 'str'>,
{'dest': <class 'str'>, Optional('on_conflict'): Or('skip', 'overwrite', 'trash', 'rename_new', 'rename_existing'), Optional('rename_template'): <class 'str'>, Optional('filesystem'): <class 'object'>})}),
Optional({'python': Or(<class 'str'>, {'code': <class 'str'>, Optional('run_in_simulation'): <class 'bool'>})}), Optional({'rename': Or(<class 'str'>, {'name': <class 'str'>, Optional('on_conflict'): Or('skip',
'overwrite', 'trash', 'rename_new', 'rename_existing'), Optional('rename_template'): <class 'str'>})}), Optional({'shell': Or(<class 'str'>, {'cmd': <class 'str'>, Optional('run_in_simulation'): <class 'bool'>,
Optional('ignore_errors'): <class 'bool'>, Optional('simulation_output'): <class 'str'>, Optional('simulation_returncode'): <class 'int'>})}), Optional({'symlink': Or(<class 'str'>, [<class 'str'>], Schema({}))}),
Optional('trash')]}) did not validate {'name': 'Scripts'}
Missing keys: 'actions', 'locations'
During handling of the above exception, another exception occurred:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Traceback (most recent call last) โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ /usr/lib/python3.10/site-packages/organize/cli.py:254 in check โ
โ โ
โ 251 โ โ โ out.print("\n\n") โ
โ 252 โ โ โ out.rule("Schema validation", align="left") โ
โ 253 โ โ โ
โ โฑ 254 โ โ validate(rules) โ
โ 255 โ โ โ
โ 256 โ โ if debug: โ
โ 257 โ โ โ out.print("Validation ok.") โ
โ โ
โ /usr/lib/python3.10/site-packages/organize/config.py:103 in validate โ
โ โ
โ 100 โ
โ 101 โ
โ 102 def validate(config: dict): โ
โ โฑ 103 โ return CONFIG_SCHEMA.validate(config) โ
โ 104 โ
โ โ
โ /usr/lib/python3.10/site-packages/schema.py:409 in validate โ
โ โ
โ 406 โ โ โ โ โ โ โ โ except SchemaError as x: โ
โ 407 โ โ โ โ โ โ โ โ โ k = "Key '%s' error:" % nkey โ
โ 408 โ โ โ โ โ โ โ โ โ message = self._prepend_schema_name(k) โ
โ โฑ 409 โ โ โ โ โ โ โ โ โ raise SchemaError([message] + x.autos, [e.format(dat โ
โ 410 โ โ โ โ โ โ โ โ else: โ
โ 411 โ โ โ โ โ โ โ โ โ new[nkey] = nvalue โ
โ 412 โ โ โ โ โ โ โ โ โ coverage.add(skey) โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
SchemaError: 'organize rule configuration' Key 'rules' error:
Or({Optional('name'): <class 'str'>, Optional('enabled'): <class 'bool'>, Optional('subfolders'): <class 'bool'>, Optional('filter_mode'): Or('all', 'any', 'none'), Optional('tags'): Or(<class 'str'>, [<class
'str'>]), Optional('targets'): Or('dirs', 'files'), 'locations': Or(<class 'str'>, [Or(<class 'str'>, {'path': And(<class 'str'>, <built-in function len>), Optional('max_depth'): Or(<class 'int'>, None),
Optional('search'): Or('depth', 'breadth'), Optional('exclude_files'): Or(<class 'str'>, [<class 'str'>]), Optional('exclude_dirs'): Or(<class 'str'>, [<class 'str'>]), Optional('system_exclude_files'): Or(<class
'str'>, [<class 'str'>]), Optional('system_exclude_dirs'): Or(<class 'str'>, [<class 'str'>]), Optional('filter'): Or(<class 'str'>, [<class 'str'>]), Optional('filter_dirs'): Or(<class 'str'>, [<class 'str'>]),
Optional('ignore_errors'): <class 'bool'>, Optional('filesystem'): <class 'object'>})]), Optional('filters'): [Optional(Or(Schema(Or('not created', 'created')), {Schema(Or('not created', 'created')):
{Optional('mode'): Or('older', 'newer'), Optional('years'): <class 'int'>, Optional('months'): <class 'int'>, Optional('weeks'): <class 'int'>, Optional('days'): <class 'int'>, Optional('hours'): <class 'int'>,
Optional('minutes'): <class 'int'>, Optional('seconds'): <class 'int'>}})), Optional(Or(Schema(Or('not date_added', 'date_added')), {Schema(Or('not date_added', 'date_added')): {Optional('mode'): Or('older',
'newer'), Optional('years'): <class 'int'>, Optional('months'): <class 'int'>, Optional('weeks'): <class 'int'>, Optional('days'): <class 'int'>, Optional('hours'): <class 'int'>, Optional('minutes'): <class
'int'>, Optional('seconds'): <class 'int'>}})), Optional(Or(Schema(Or('not duplicate', 'duplicate')), {Schema(Or('not duplicate', 'duplicate')): Or(<class 'str'>, [<class 'str'>], Schema({}))})),
Optional(Schema(Or('not empty', 'empty'))), Optional(Or(Schema(Or('not exif', 'exif')), {Schema(Or('not exif', 'exif')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not extension',
'extension')), {Schema(Or('not extension', 'extension')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not filecontent', 'filecontent')), {Schema(Or('not filecontent', 'filecontent')):
Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not hash', 'hash')), {Schema(Or('not hash', 'hash')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional(Or(Schema(Or('not name',
'name')), {Schema(Or('not name', 'name')): Or(<class 'str'>, {Optional('match'): <class 'str'>, Optional('startswith'): Or(<class 'str'>, [<class 'str'>]), Optional('contains'): Or(<class 'str'>, [<class 'str'>]),
Optional('endswith'): Or(<class 'str'>, [<class 'str'>]), Optional('case_sensitive'): <class 'bool'>})})), Optional(Or(Schema(Or('not size', 'size')), {Schema(Or('not size', 'size')): Or(<class 'object'>, [<class
'object'>])})), Optional(Or(Schema(Or('not lastmodified', 'lastmodified')), {Schema(Or('not lastmodified', 'lastmodified')): {Optional('mode'): Or('older', 'newer'), Optional('years'): <class 'int'>,
Optional('months'): <class 'int'>, Optional('weeks'): <class 'int'>, Optional('days'): <class 'int'>, Optional('hours'): <class 'int'>, Optional('minutes'): <class 'int'>, Optional('seconds'): <class 'int'>}})),
Optional(Or(Schema(Or('not mimetype', 'mimetype')), {Schema(Or('not mimetype', 'mimetype')): Or(<class 'str'>, [<class 'str'>], Schema({}))})), Optional({Schema(Or('not python', 'python')): Or(<class 'str'>,
{'code': <class 'str'>})}), Optional({Schema(Or('not regex', 'regex')): <class 'str'>})], 'actions': [Optional(Or('confirm', {'confirm': Or(<class 'str'>, {Optional('msg'): <class 'str'>, Optional('default'):
<class 'bool'>})})), Optional({'copy': Or(<class 'str'>, {'dest': <class 'str'>, Optional('on_conflict'): Or('skip', 'overwrite', 'trash', 'rename_new', 'rename_existing'), Optional('rename_template'): <class
'str'>, Optional('filesystem'): <class 'object'>})}), Optional('delete'), Optional({'echo': <class 'str'>}), Optional({'macos_tags': Or(<class 'str'>, [<class 'str'>])}), Optional({'move': Or(<class 'str'>,
{'dest': <class 'str'>, Optional('on_conflict'): Or('skip', 'overwrite', 'trash', 'rename_new', 'rename_existing'), Optional('rename_template'): <class 'str'>, Optional('filesystem'): <class 'object'>})}),
Optional({'python': Or(<class 'str'>, {'code': <class 'str'>, Optional('run_in_simulation'): <class 'bool'>})}), Optional({'rename': Or(<class 'str'>, {'name': <class 'str'>, Optional('on_conflict'): Or('skip',
'overwrite', 'trash', 'rename_new', 'rename_existing'), Optional('rename_template'): <class 'str'>})}), Optional({'shell': Or(<class 'str'>, {'cmd': <class 'str'>, Optional('run_in_simulation'): <class 'bool'>,
Optional('ignore_errors'): <class 'bool'>, Optional('simulation_output'): <class 'str'>, Optional('simulation_returncode'): <class 'int'>})}), Optional({'symlink': Or(<class 'str'>, [<class 'str'>], Schema({}))}),
Optional('trash')]}) did not validate {'name': 'Scripts'}
Missing keys: 'actions', 'locations'
Issue Analytics
- State:
- Created a year ago
- Comments:5
Top Results From Across the Web
"Change User Name" Not Appearing as Option in Windows ...
If you only have one user on a Windows 10 PC for some unknown reason the option to change the user name does...
Read more >Fix Disappeared Files and Folders Names in Windows 10
Fix Disappeared Files and Folders Names in Windows 10โปโปโปSUBSCRIBE for more : https://www.youtube.com/user/Britec09?sub_confirmation=1Iย ...
Read more >the command find not working with -name option in sh file
When I remove the -o -name '*.json' part, the command works well, and returns the number of files containing the 'sv' in their...
Read more >How to Fix the Excel Name Error? 3 Simple Tips
Tip 3 โ Find All the #NAME Errors in Excel ยท Select the data where you want to scan for errors. ยท In...
Read more >[Solved] File Explorer Search Not Working in Windows 10
Step 4: In the Folder Options window, switch to Search tab and check Always search file names and contents option.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
well this seems to work so i guess it wasnโt a bug and it was a formatting issue
I think the next error you posted is also caused by indentation. The
locations
key needs to line up with thename
above it. They are both keys of the same map object. I can reproduce it and when I makelocations
,filters
, andactions
line up withname
above them, the error goes away.But in your next comment, your full config they look lined up correctly with the names as as far as I can tell. But I noticed that not all of your rules line up, or your locations & filters within a rule. Some of them are off by a space. I guess the theme here is that in YAML the indentation matters.