Running a Python Script from Swift

In my recent app wrdlr I use a Python script for the heavy lifting because the Python function “fnmatch” does exactly what I wanted, which is filename pattern matching with wildcards (* and ?), but for words in a dictionary. Also I wanted to work with Python again. The script is available on github.

Running a python script from within a cocoa app is really easy, as shown in this Stack Overflow post. I reimplemented it in Swift and use it like this in my app:

Continue reading