tfeldmann / organize

The file management automation tool.
http://organize.readthedocs.io
MIT License
2.01k stars 120 forks source link

TypeError: unhashable type: 'list' when using aliases #390

Open zany130 opened 1 month ago

zany130 commented 1 month ago

Describe the bug after updating to 3.2.3 (from 2.2.0) organize run gives the following error

Traceback (most recent call last):
  File "/home/zany130/.local/bin/organize", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/zany130/.local/pipx/venvs/organize-tool/lib/python3.12/site-packages/organize/cli.py", line 276, in cli
    _execute(simulate=False)
  File "/home/zany130/.local/pipx/venvs/organize-tool/lib/python3.12/site-packages/organize/cli.py", line 135, in execute
    Config.from_string(
  File "/home/zany130/.local/pipx/venvs/organize-tool/lib/python3.12/site-packages/organize/config.py", line 69, in from_string
    inst = cls(**as_dict)
           ^^^^^^^^^^^^^^
  File "/home/zany130/.local/pipx/venvs/organize-tool/lib/python3.12/site-packages/pydantic/_internal/_dataclasses.py", line 140, in __init__
    s.__pydantic_validator__.validate_python(ArgsKwargs(args, kwargs), self_instance=s)
  File "/home/zany130/.local/pipx/venvs/organize-tool/lib/python3.12/site-packages/organize/location.py", line 51, in ensure_set
    return set(value)
           ^^^^^^^^^^
TypeError: unhashable type: 'list'

Screenshots If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

Your config file

private_folders: &Pfolders
    - "pCloudDrive"
    - ".*"
    - "Applications"
    - "OneDrive"

private_files: &Pfiles 
    - ".steampath"

rules:
#--------------------------------------------------------------------
    - name: move screenshots into "Screenshots" folder
      locations:
          - path : ~/Pictures/
            max_depth : 1
            exclude_dirs: [*Pfolders, "Screenshots"]
      filters:
          - name:
                contains: "Screen"
                case_sensitive: false
      actions:
          - move: 
                dest: ~/Pictures/Screenshots/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: move Recordings into "Recordings" folder
      locations:
          - ~/Videos/
          - /mnt/GAMES/Videos/
      filters:
          - name:
                contains:
                  - "Record"
                  - "Replay"
                case_sensitive: false
      actions:
          - move:
                dest: /mnt/GAMES/Videos/Recordings/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: move Documents into documents folder
      locations:
          - path: ~/
            max_Depth: 2
            exclude_dirs: [*Pfolders, "Documents"]
            exclude_files: [*Pfiles]
      filters:
          - extension:
            - doc
            - docx
            - msg
            - odt
            - pages
            - wpd
            - wps
            - gddoc
            - ppt
            - pptx
            - xlr
            - xls
            - xlsx
            - pdf
            - mobi
      actions:
          - move: 
                dest: ~/Documents/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: move Log files into Logs folder
      locations:
          - path: ~/
            max_Depth: 2
            exclude_dirs: [*Pfolders, "Logs"]
            exclude_files: [*Pfiles]
      filters:
          - extension:
            - log
      actions:
          - move:
                dest: ~/Logs/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: Move applications into Applications folder
      locations:
        - path: ~/
          max_Depth: 2
          exclude_dirs: [*Pfolders, "Applications"]
          exclude_files: [*Pfiles]
      filters:
          - extension:
            - apk
            - app
            - exe
            - msi
            - jar
            - appimage
            - rpm
            - deb
            - pkg
            - .pkg.tar.xz
            - .pkg.tar.zst
      actions:
          - move:
                dest: ~/Applications/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

    - name: Move audio files into music folder
      locations:
          - path: ~/
            max_Depth: 2
            exclude_dirs: [*Pfolders, "Music"]
            exclude_files: [*Pfiles]
      filters:
          - extension:
            - aif
            - iff
            - m3u
            - m4a
            - mid
            - mp3
            - mpa
            - wav
            - wma
      actions:
          - move:
                dest: ~/Music/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: Move video files into Videos
      locations:
          - path: ~/
            max_Depth: 2
            exclude_dirs: [*Pfolders, "Videos"]
            exclude_files: [*Pfiles]
      filters:
          - extension:
            - 3g2
            - 3gp
            - asf
            - avi
            - flv
            - m4v
            - mov
            - mp4
            - mpg
            - rm
            - srt
            - swf
            - vob
            - wmv
      actions:
          - move:
                dest: /mnt/GAMES/Videos/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

      name: Move image files into Pictures
      locations:
          - path: ~/
            max_Depth: 2
            exclude_dirs: [*Pfolders, "Pictures"]
            exclude_files: [*Pfiles]
      filters:
          - extension:
            - bmp
            - dds
            - gif
            - heic
            - jpg
            - png
            - psd
            - pspimage
            - tga
            - thm
            - tif
            - tiff
            - yuv
            - ai
            - eps
            - svg
      actions:
          - move: 
                dest: ~/Pictures/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: Move Archives into compressed folder
      locations:
          - ~/Downloads/
      filters:
          - extension:
            - tar
            - 7z
            - cbr
            - gz
            - rar
            - sitx
            - gz
            - zst
            - xz
            - zip
            - zipx
      actions:
          - move:
                dest: ~/Downloads/Compressed/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

    - name: Move Scripts into Scripts folder
      locations:
        - path: ~/
          max_Depth: 2
          exclude_dirs: [*Pfolders, "Scripts", "Applications", "emudeck"]
          exclude_files: [*Pfiles]
      filters:
          - extension:
            - sh
            - bat
            - vbs
      actions:
          - move: 
                dest: ~/Scripts/
                on_conflict: rename_new
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: Move 3ds roms into 3ds rom folder
      locations:        
        - path: ~/Downloads
          max_Depth: 2
          exclude_dirs: []
          exclude_files: []
      filters:
        - extension:
          - 3ds
          - cci
          - cfa
          - cia
          - csu
          - cxi
      actions:
        - move:
              dest: /mnt/GAMES/Emulation/roms/3ds/
              on_conflict: skip
              rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

    - name: Move n64 roms into n64 rom folder
      locations:
        - path: ~/Downloads
          max_Depth: 2
          exclude_dirs: []
          exclude_files: []
      filters:
          - extension:
            - z64
            - n64
            - N64
            - u64
            - v64
            - usa
            - pal
            - jap
      actions:
          - move:
                dest: /mnt/GAMES/Emulation/roms/n64/
                on_conflict: skip
                rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

    - name: Move nds roms into nds rom folder
      locations:
        - path: ~/Downloads
          max_Depth: 2
          exclude_dirs: []
          exclude_files: []
      filters:
          - extension:
            - nds
            - srl
            - tad
      actions:
          - move:
                dest: /mnt/GAMES/Emulation/roms/nds/
                on_conflict: skip
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: Move nes roms into nes rom folder
      locations:
        - path: ~/Downloads
          max_Depth: 2
          exclude_dirs: []
          exclude_files: []
      filters:
          - extension:
            - nes
      actions:
          - move:
                dest: /mnt/GAMES/Emulation/roms/nes/
                on_conflict: skip
                rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

    - name: Move snes roms into snes rom folder
      locations:
        - path: ~/Downloads
          max_Depth: 2
          exclude_dirs: []
          exclude_files: []
      filters:
          - extension:
            - sfc
      actions:
          - move:
                dest: /mnt/GAMES/Emulation/roms/snes/
                on_conflict: skip
                rename_template: "{name}-{counter}{extension}"
#--------------------------------------------------------------------

    - name: Move GB roms into GB rom folder
      locations:
          - path: ~/Downloads
            max_Depth: 2
            exclude_dirs: []
            exclude_files: []
      filters:
          - extension:
            - gb
      actions:
          - move:
                dest: /mnt/GAMES/Emulation/roms/gb/
                on_conflict: skip
                rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

    - name: Move GBC roms into GBC rom folder
      locations:
          - path: ~/Downloads
            max_Depth: 2
            exclude_dirs: []
            exclude_files: []
      filters:
          - extension:
            - gbc
      actions:
          - move:
                dest: /mnt/GAMES/Emulation/roms/gbc/
                on_conflict: skip
                rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

    - name: Move GBA roms into GBA rom folder
      locations:
          - path: ~/Downloads
            max_Depth: 2
            exclude_dirs: []
            exclude_files: []
      filters:
          - extension:
            - gba
      actions:
          - move:
                dest: /mnt/GAMES/Emulation/roms/gba/
                on_conflict: skip
                rename_template: "{name}-{counter}{extension}"

#--------------------------------------------------------------------

EDIT: installing from the aur gives

organize run
Traceback (most recent call last):
  File "/usr/bin/organize", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/lib/python3.12/site-packages/organize/cli.py", line 251, in cli
    parsed_args = docopt(
                  ^^^^^^^
TypeError: docopt() got an unexpected keyword argument 'default_help'
zany130 commented 1 month ago

hmm it looks like what it doesn't like is the aliases I use for example *Pfolders

keywal commented 2 weeks ago

Hey @zany130 Just wanted to let you know i came across this same problem last night after installing from AUR.

I resolved it by

  1. deleting the 'organize' file in /usr/bin
  2. installing 'python-pipx' through pacman - sudo pacman -S python-pipx
  3. then installing 'organize-tool' through pip with - pipx install organize-tool (might need to add --force, to the end)
zany130 commented 2 weeks ago

Hey @zany130 Just wanted to let you know i came across this same problem last night after installing from AUR.

I resolved it by

  1. deleting the 'organize' file in /usr/bin
  2. installing 'python-pipx' through pacman - sudo pacman -S python-pipx
  3. then installing 'organize-tool' through pip with - pipx install organize-tool (might need to add --force, to the end)

Yes I was also running into that issue with aur package

this is a separate issue where orgainse 3 doesn't like the private folder options in my config.

so even if I get organize 3 installed through pipx it still fails with a type error because of the private folder section in my config.

removing that and then removing all references to those folders fixes the issue, but obviously this is not a feasible workaround so I just downgraded to organize 2 for now

zany130 commented 6 hours ago

@tfeldmann any updates still not working on latest git