Error when using Hooks

I get an error when using the hooks plugin, Haven’t seen this work yet so i’m not sure if i’m not using it correct or missing a dependancy or something, but here is the output i get when i enable the plugin

F:\Download Queues\Complete\Music - Lidarr\Iron.Maiden.-.Maiden.Japan.(2021.Remaster).(2021).[24Bit-96kHz].FLAC.[PMEDIA].­_ϸ_ (5 items)
Skipping.
--- Logging error ---
Traceback (most recent call last):
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\logging\__init__.py", line 1101, in emit
    stream.write(msg + self.terminator)
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u03f8' in position 128: character maps to <undefined>
Call stack:
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\threading.py", line 966, in _bootstrap
    self._bootstrap_inner()
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\site-packages\beets\util\pipeline.py", line 311, in run
    out = self.coro.send(msg)
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\site-packages\beets\util\pipeline.py", line 170, in coro
    task = func(*(args + (task,)))
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\site-packages\beets\importer.py", line 1400, in user_query
    task.choose_match(session)
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\site-packages\beets\importer.py", line 861, in choose_match
    session.log_choice(self)
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\site-packages\beets\importer.py", line 281, in log_choice
    self.tag_log('skip', paths)
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\site-packages\beets\importer.py", line 260, in tag_log
    self.logger.info('{0} {1}', status, displayable_path(paths))
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\logging\__init__.py", line 1468, in info
    self._log(INFO, msg, args, **kwargs)
  File "C:\Users\Andrew Sutcliffe\AppData\Local\Programs\Python\Python310\lib\site-packages\beets\logging.py", line 88, in _log
    return super()._log(level, m, (), exc_info, extra)
Message: <beets.logging.StrFormatLogger._LogMessage object at 0x00000214B52008E0>
Arguments: ()

Here is the syntax of the hook’s i’m using


hook:
  hooks:
    # Output on exit:
    #   beets just exited!
    #   have a nice day!
    - event: cli_exit
      command: echo "beets just exited!"
    - event: cli_exit
      command: echo "have a nice day!"

    # Output on item import:
    #   importing "<file_name_here>"
    # Where <file_name_here> is the item being imported
    - event: item_imported
      command: echo "importing "{album.path}"

    # Output on write:
    #   writing to "<file_name_here>"
    # Where <file_name_here> is the file being written to
    #- event: write
     # command: echo "writing to {path}"

Hmm; that’s somewhat troubling. Is there any chance that your machine is set up with a CP-1252 (old-style Windows) locale? Could you consider configuring a UTF-8 locale?

Short rant: A frustrating thing about Python 3 is that crashes like this, like in the standard logging library, are possible on some locales and applications have no reasonable way to fix them. Python 3 attempts to provide an abstraction where you just print arbitrary Unicode and the system takes care of encodings, but this can of course go wrong if Python decides the system wants a limited/non-UTF-8 encoding. And because this is all hidden beneath an abstraction layer, there is no API the application can use to work around it or detect when it might happen.

Sorry it’s taken me so long to circle back, I am not familiar with any of that…
the locale of my system is English US… I’m running windows 10 pro

I did some quick googling which led me to the article below. trying it now to see if anything different happens. I’ve never changed the locale on a system before (never needed too) so i’m not sure exactly what that does. If it breaks something else, I’ll change it back, but if i don’t notice anything broken and it fixes the issue…then thats good i guess.

After enabling UTF-8 …or even before i enabled it, I also get this behavior

hook: hook for write failed: [WinError 2] The system cannot find the file specified

This error repeats foreach time the loop occurs … I also experienced this regardless of enabling UTF-8

you should probably know that if i can’t get this “hooks” thing to work, it’s not a deal breaker for me or anything…it does most of what i need it to do at it’s core functionality so this isn’t really a deal breaker, just exploring how robust i can make my configuration with all the whistles added to it.

Most likely that means you don’t have a program called echo (which is, after all, a Unixy thing)? I’m not familiar enough with Windows to know what an equivalent would be…

ah…there is a command called echo via command prompt which repeats back output…like for example echo hello world would output “hello world” …is this not what the hook would be doing?..maybe i misunderstood what the function does…

That is the idea! But I thought the error above was indicating that the echo command could not be found. But again, I am clueless enough about Windows that I could have it all wrong!

no worries… yeah idk…probably some ENV var not being called or found…hell idk, thanks for the reply sir