Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zany130 opened this issue Jun 6, 2024 · 7 comments
Closed

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

zany130 opened this issue Jun 6, 2024 · 7 comments
Labels

Comments

@zany130
Copy link

zany130 commented Jun 6, 2024

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):

  • OS: Garuda Linux
  • Output of organize --version:organize v3.2.3

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 zany130 added the bug label Jun 6, 2024
@zany130
Copy link
Author

zany130 commented Jun 6, 2024

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

@zany130 zany130 changed the title TypeError: unhashable type: 'list' TypeError: unhashable type: 'list' when using aliases Jun 6, 2024
@keywal
Copy link

keywal commented Jun 18, 2024

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
Copy link
Author

zany130 commented Jun 18, 2024

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
Copy link
Author

zany130 commented Jul 8, 2024

@tfeldmann any updates still not working on latest git

@tfeldmann
Copy link
Owner

Thanks for reporting and for the reproducer! Bug is fixed now and will be released as soon as possible.

@tfeldmann
Copy link
Owner

Just forgot: You have some max_Depth in your config which must be renamed to max_depth.

@tfeldmann
Copy link
Owner

New version is out 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants