organize
organize copied to clipboard
TypeError: cannot unpack non-iterable NoneType object
Describe the bug
Fresh installation on windoze 11 according to the documentation.
Testing with the most basic config, organize run|check throws TypeError: cannot unpack non-iterable NoneType object
Config file resides in here:
%USERPROFILE%\AppData\Local\organize\organize\config.yaml
file encoding is UTF-8
Any changes to config.yaml won't succeed.
Expected behavior Get stuff running, somehow ;-)
Screenshots
organize check --debug
Checking: C:\Users\Gnarf\AppData\Local\organize\organize\config.yaml
Raw ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
# organize configuration file
# https://organize.readthedocs.io
rules:
- locations:
- # your locations here
filters:
- # your filters here
actions:
- # your actions here
Loaded ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
{'rules': [{'locations': [None], 'filters': [None], 'actions': [None]}]}
Cleaned ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
{'rules': [{'locations': [None], 'filters': [None], 'actions': [None]}]}
Migration from v1 ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
┌─────────────────────────────── Traceback (most recent call last) ────────────────────────────────┐
│ │
│ C:\Users\Gnarf\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalC │
│ ache\local-packages\Python310\site-packages\organize\cli.py:247 in check │
│ │
│ 244 │ │ │ out.print("\n\n") │
│ 245 │ │ │ out.rule("Migration from v1", align="left") │
│ 246 │ │ │
│ > 247 │ │ migration.migrate_v1(rules) │
│ 248 │ │ │
│ 249 │ │ if debug: │
│ 250 │ │ │ out.print("Not needed.") │
│ C:\Users\Gnarf\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalC │
│ ache\local-packages\Python310\site-packages\organize\migration.py:27 in migrate_v1 │
│ │
│ 24 │ │ if "folders" in rule: │
│ 25 │ │ │ raise NeedsMigrationError("`folders` are now `locations`") │
│ 26 │ │ for fil in rule.get("filters") or []: │
│ > 27 │ │ │ name, _ = entry_name_args(fil) │
│ 28 │ │ │ if name == "filename": │
│ 29 │ │ │ │ raise NeedsMigrationError("`filename` is now `name`") │
│ 30 │ │ │ if name == "filesize": │
└──────────────────────────────────────────────────────────────────────────────────────────────────┘
TypeError: cannot unpack non-iterable NoneType object
Environment (please complete the following information):
- OS: WIndows 11, latest updates
- Python 3.10.4
- Output of
organize --version: organize, version 2.2.0
Your config file
rules:
- name: "Find PDFs"
locations:
- ~/Downloads
subfolders: true
filters:
- extension: pdf
actions:
- echo: "Found PDF!"
Just ran into this - commenting out the migration.migrate_v1(rules) line seemed to solve the issue, but also resulted in an Invalid config file! error. This was caused by malformed yaml on my end, so seems like an issue in the migration logic if you don't have anything to migrate.
The problem seems to be that the wrong config file is loaded. As you can see in check --debug output your config file is located at C:\Users\Gnarf\AppData\Local\organize\organize\config.yaml and contains
# organize configuration file
# https://organize.readthedocs.io
rules:
- locations:
- # your locations here
filters:
- # your filters here
actions:
- # your actions here
Which is invalid...
If you want to run a specific config file you have to add its path to the command, eg:
organize sim myconfig.yml.
So what's really inside this file? Or am I reading this wrong?
Closing this as it was most likely simply the starter config file.