I've been recently hitting a Python 2 bug in Windows. When using subprocess, if the process name or any of the arguments contain non-ascii characters, an error like the following is raised:
UnicodeEncodeError: 'ascii' codec can't encode character u'\xc5' in position 5: ordinal not in range(128).
It's the issue on the official bug tracker here, fixed in Python 3 but not Python 2. Looks like the problem stems from using CreateProcessA instead of CreateProcessW. Most of the workarounds listed on this page don't actually work -- specifying a code page will still fail for many unicode characters.
My workaround will work, although it's not very elegant.
It requires only winprocess.py (MIT License), which doesn't have further dependencies (just comment out the unneeded references to QueryInformationJobObject).
Here's a way to simulate running with ShellExecute (like passing shell=True to subprocess): you can pass to cmd.exe. For example, in Windows, to open a file with its default program, you can use runWithoutWaitUnicode([u'cmd', u'/c', u'start', filePath]). This can also be used to open a directory in explorer.
I've placed the full code, including tests, here (search for runWithoutWaitUnicode).
Next post: Coordinate-Music: tools to organize music files