Reported by mdcurran on 2012-10-18 10:42
Python's tempfile.get_default_tempdir() normalizes case on all candidate temp paths. If the path happens to contain multibyte characters this is bad as changing case completely destroys the original value of the path.
For example: the unicode string "川山" is encoded in CP932 (Japanese) as "\x90\xec\x8eR".
If this string is run through os.path.normcase, the final "R" is converted to "r" which is very wrong.
In the end if none of the candidate temp paths can be used due to this reason, or because some of them simply cannot be written to, then tempfile.gettempdir() raises an error and NVDA fails to start.
Its worth noting that if deleting the user's temp and tmp environment variables to try and get around this, the temp path falls back to c:\windows\temp. NVDA also fails hear but not for the reason above. It fails here simply because it cannot create its log file in this directory due to lack of permissions. This particular issue should be handled in a separate ticket.
Comment 1 by mdcurran on 2012-10-18 10:50
Fixed in 2f4847f
Comment 2 by jteh on 2012-10-19 02:30
I've added a comment to PythonIssue:14255 concerning this issue.
Comment 3 by jteh on 2012-10-19 06:58
Reworked fix in f6a3112 to address further reported issues.
Comment 4 by jteh on 2012-10-31 00:29
Further change in 2dbb881.
Comment 5 by mdcurran on 2013-02-01 18:47
A further fix in c0c5b69. We originally fixed NVDA starts by patching in nvda.pyw, but after further testing it seems that installing was also broken in this particular situation as nvda_slave imports comtypes.client which does things with tempfile.gettempdir. Now both nvda.pyw and nvda_slave.pyw patch tempfile.
Comment 6 by nvdakor on 2014-06-08 17:01
The Python issue has been resolved (according to the message for 14255) in either 2.7.6 or 2.7.7. So if either version fixes this, we might as well remove Python Monkey Patches file for now.
Comment 7 by nvdakor on 2014-06-08 17:20
A temporary fix is available (for users of Python 2.7.6/2.7.7.):