Jump to content

UTF-8 is not a valid value for LC_CTYPE flag; exception in Python workflows [Fixed 2.7.1 b387]


Recommended Posts

Any python workflow using locale.getdefaultlocale() will crash in Alfred 2.7 due to an unhandled exception. Since the python docs do not suggest that it is even possible for an exception to be thrown from that function, I do not imagine anyone wrapped this in a try block.


I received some bug reports this weekend from some pre-release path folks who were seeing errors about unknown locale: UTF-8. I noticed in the release notes for the latest Alfred that the following change was made:

• Add LC_CTYPE=UTF-8 encoding to script environment


However, UTF-8 is not a valid value for this flag. Is this something that can be reverted or is there some case where it actually works? As a temporary workaround I was able to redefine LC_CTYPE in each of the bash scripts in the workflow, but hopefully that should not be necessary going forward.

export LC_CTYPE="$(defaults read -g AppleLocale).UTF-8"


Download a simple workflow that tests this bug. Type lcctype in alfred then action the result – it should show your current locale in large type but will instead fail with an exception.

Edited by ipaterson
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...