Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
msvc9_query_vcvarsall returns unicode strings on Python 2.7 64-bit and regular strings on 32-bit #992
msvc9_query_vcvarsall returns environment dict with keys "lib", "libpath", "include" and "PATH". On Python 2.7 32-bit values of this dict are regular strings, however on Python 2.7 64-bit this dict contains unicode strings. So when I later use this dict to update os.environ it throws an error:
Not sure if this is a bug or not, if not you can close it. It's not a big deal for me, I already have it fixed in my code.
added a commit
Apr 8, 2017
I am sorry, but this issue seems to be invalid and your commits should be reversed. I retested and msvc9_query_vcvarsall() returns unicode on both Python 2.7 32-bit and 64-bit. Previously I have been testing multiple Python flavors and must got confused somewhere on the way. The issue in my code with updating os.environ is still valid, as you can't update it with unicode strings on Python 2.7, however this is not an issue with setuptools. I have checked distutils query_vcvarsall() in distutils/msvc9compiler.py and this function calls str.decode("mbcs"), so it returns unicode strings. So looks like setuptools should be returning unicode strings as well. Again, sorry for causing the trouble.
However there is one bug in setuptools that I've noticed - but that's a separate issue. EnvironmentInfo().return_env() replaces unicode characters with its ascii equivalents. I've added "C:\Tęstą" to my PATH env variable and setuptools returned it as "C:\Testa" - which is an invalid directory. It's not an issue for me, but looks like a bug.