[Scons-users] Help regarding IOError(stderr.decode("mbcs"))

Aseem Shakuntal kri80vt at outlook.com
Wed Feb 5 04:21:13 EST 2014


Hi Gary,
So, I am using python.org python. No error is printed by the bat script run from either scons or subprocess. I did not take a closer look to _subproc in Action.py but I have no idea why, the popen.wait() in common.py (Tool/MSCommon/) returns -1, hence, explicitly raising the IOError.
To make things work in python x86 install, I just commented out the raise IOError and things work OK (though, not sure what side-effects it might have). print ("Added by aseem (in common.py, get_output), stdout is: %s" % str(stdout)) print ("Added by aseem (in common.py, get_output), stderr is: %s" % str(stderr)) x = popen.wait() print ("value of popen.wait() is: %d" % x) #Commented to avoid #if x != 0: # print ("popen.wait() != 0, raise IOError :/") # raise IOError(stderr.decode("mbcs"))
Part of logs without the above code commented.------------------------8<--------------------------Hey there (in Action.py, _subproc), command: "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64 & setHey there (in Action.py, _subproc), keywords: stdin, env, stderr, stdoutAdded by aseem, stdout (in common.py, get_output) is: Setting environment for using Microsoft Visual Studio 2010 x64 tools.CommandPromptType=NativeFramework35Version=v3.5FrameworkDir=c:\Windows\Microsoft.NET\Framework64FrameworkDIR64=c:\Windows\Microsoft.NET\Framework64FrameworkVersion=v4.0.30319FrameworkVersion64=v4.0.30319FSHARPINSTALLDIR=C:\Program Files (x86)\Microsoft F#\v4.0\INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\include;LIB=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\amd64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\lib\x64;LIBPATH=c:\Windows\Microsoft.NET\Framework64\v4.0.30319;c:\Windows\Microsoft.NET\Framework64\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\LIB\amd64;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\ATLMFC\LIB\amd64;Platform=X64PROMPT=$P$GTMP=C:\Users\ashakunt\AppData\Local\TempCOMSPEC=C:\Windows\system32\cmd.exeTEMP=C:\Users\ashakunt\AppData\Local\TempSystemDrive=C:PATHEXT=.COM;.EXE;.BAT;.CMDPATH=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\amd64;c:\Windows\Microsoft.NET\Framework64\v4.0.30319;c:\Windows\Microsoft.NET\Framework64\v3.5;C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools\x64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\x64;C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin;C:\Windows\System32SystemRoot=C:\WindowsVCINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\VS100COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Tools\VSINSTALLDIR=C:\Program Files (x86)\Microsoft Visual Studio 10.0\WindowsSdkDir=C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Added by aseem (in common.py, get_output), stderr is: value of popen.wait() is: -1popen.wait() != 0, raise IOError :/--------------------------------->8-------------------------------------------------
Further, I tried the same scenario with a simple python script:
import subprocess
proc = subprocess.Popen(["C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat", "amd64", "&", "set"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout = proc.stdout.read()stderr = proc.stderr.read()
x = proc.wait()
print ("process return code is: %d\n" %x)print ("stdout is: %s\n" % stdout)print ("stderr is: %s\n" % stderr)
Which works just fine.
Attached with this email is the scons-error.txt, which gives the exact output of stdout, stderr (which is null, btw).
Br, Aseem
On 4.2.2014 17:51 Gary Oberbrunner wrote:
Interesting. SCons should work fine with x86 python; that's what I use onWindows. Are you using cygwin python or python.org python? I'd still beinterested to see what the error printed by the bat script when run fromyour x86 python was -- we may be able to improve that error-handling (andmaybe even make it work properly).
From: kri80vt at outlook.com
To: scons-users at scons.org
CC:
Date: Tue, 4 Feb 2014 16:20:26 +0000
Subject: Re: [Scons-users] Help regarding IOError(stderr.decode("mbcs"))


Hi Gary,


Already out of office now. Will provide you the details tomorrow.


Br, Aseem

--

Sent from my Nokia N9

On 4.2.2014 17:51 Gary Oberbrunner wrote:


Interesting. SCons should work fine with x86 python; that's what I use on

Windows. Are you using cygwin python or python.org python? I'd still be

interested to see what the error printed by the bat script when run from

your x86 python was -- we may be able to improve that error-handling (and

maybe even make it work properly).







On Tue, Feb 4, 2014 at 10:38 AM, Aseem Shakuntal <kri80vt at outlook.com>wrote:






> Hi Gary,



>



> The python installed was x86 version. I changed that to x86_64 and then



> scons works just fine. So, the problem really is, imho, that in python x86



> installation on an x86_64 machine the error is not reported correct. Since,



> scons still invokes vcvarsall.bat with amd64 argument, should it make sense



> to check if python is an x86 installation?



>



> Not sure if this could be treated as a bug?



>



> Br, Aseem



>



> ------------------------------



> Date: Tue, 4 Feb 2014 10:28:30 -0500



>



> From: kri80vt at outlook.com



> To: kri80vt at outlook.com



> Subject: Re: [Scons-users] Help regarding IOError(stderr.decode("mbcs"))



>



> I'm not sure why it's giving an error, but I notice that code isn't



> printing stdout when an error happens, and if the error is coming from the



> bat script then it's surely in stdout. Can you print stdout.decode("mbcs")



> at the point of the error? It might have a clue.



>



>



> On Tue, Feb 4, 2014 at 8:52 AM, Aseem Shakuntal <kri80vt at outlook.com>wrote:



>



> Hi Gary,



>



> As for the scons version is concerned, I have been getting the same error



> even with 2.3.0 and hence, decided to step down a bit on version to see it



> that works.



>



> IMHO, you are right, it might be nothing related to mbcs. I took a look in



> the files and found that popen.wait doesn't return success code, which



> inturn, raises IOError(stderr.decode("mbcs")). Any pointers?



>



> Apparently, it points me to "vcvarsall.bat" which is called with arguments



> amd64. When I run the file from cmd.exe with amd64 as the argument, it



> seems like working just fine!



>



> C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC>vcvarsall.bat amd64



> Setting environment for using Microsoft Visual Studio 2010 x64 tools.



>



> Below is the debug information from scons..



>



> E:\scons-test>set SCONS_MSCOMMON_DEBUG=-



>



> E:\scons-test>scons



> scons: Reading SConscript files ...



> trying to find VC 11.0



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 11.0



> trying to find VC 11.0Exp



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VCExpress\\11.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 11.0Exp



> trying to find VC 10.0



> find_vc_dir(): found VC in registry: C:\Program Files (x86)\Microsoft



> Visual Studio 10.0\VC\



> found VC 10.0



> trying to find VC 10.0Exp



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VCExpress\\10.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 10.0Exp



> trying to find VC 9.0



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VisualStudio\\9.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 9.0



> trying to find VC 9.0Exp



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VCExpress\\9.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 9.0Exp



> trying to find VC 8.0



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VisualStudio\\8.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 8.0



> trying to find VC 8.0Exp



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VCExpress\\8.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 8.0Exp



> trying to find VC 7.1



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.1\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 7.1



> trying to find VC 7.0



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir'



> find_vc_pdir return None for ver 7.0



> trying to find VC 6.0



> find_vc_dir(): no VC registry key



> 'Software\\Wow6432Node\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft



> Visual C++\\ProductDir'



> find_vc_pdir return None for ver 6.0



> msvc_setup_env()



> get_default_version()



> get_default_version(): msvc_version:None msvs_version:None



> installed_vcs:['10.0']



> msvc_setup_env: using default installed MSVC version '10.0'



>



> msvc_setup_env: using specified MSVC version '10.0'



>



> vc.py:msvc_find_valid_batch_script()



> vc.py:get_host_target()



> vc.py:get_host_target() req_target_platform:x86_64



> vc.py:msvc_find_valid_batch_script() trying target_platform:amd64



> find_vc_dir(): found VC in registry: C:\Program Files (x86)\Microsoft



> Visual Studio 10.0\VC\



> vc.py: find_batch_file() pdir:C:\Program Files (x86)\Microsoft Visual



> Studio 10.0\VC\



> sdk.py:get_installed_sdks()



> MSCommon/sdk.py: trying to find SDK 7.0



> find_sdk_dir(): checking registry:Software\Microsoft\Microsoft



> SDKs\Windows\v7.0\InstallationFolder



> find_sdk_dir(): no SDK registry key 'Software\\Microsoft\\Microsoft



> SDKs\\Windows\\v7.0\\InstallationFolder'



> MSCommon/sdk.py: trying to find SDK 6.1



> find_sdk_dir(): checking registry:Software\Microsoft\Microsoft



> SDKs\Windows\v6.1\InstallationFolder



> find_sdk_dir(): no SDK registry key 'Software\\Microsoft\\Microsoft



> SDKs\\Windows\\v6.1\\InstallationFolder'



> MSCommon/sdk.py: trying to find SDK 6.0A



> find_sdk_dir(): checking registry:Software\Microsoft\Microsoft



> SDKs\Windows\v6.0A\InstallationFolder



> find_sdk_dir(): no SDK registry key 'Software\\Microsoft\\Microsoft



> SDKs\\Windows\\v6.0A\\InstallationFolder'



> MSCommon/sdk.py: trying to find SDK 6.0



> find_sdk_dir(): checking registry:Software\Microsoft\Microsoft



> SDKs\Windows\v6.0\InstallationFolder



> find_sdk_dir(): no SDK registry key 'Software\\Microsoft\\Microsoft



> SDKs\\Windows\\v6.0\\InstallationFolder'



> MSCommon/sdk.py: trying to find SDK 2003R2



> find_sdk_dir(): checking



> registry:Software\Microsoft\MicrosoftSDK\InstalledSDKS\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1\Install



> Dir



> find_sdk_dir(): no SDK registry key



> 'Software\\Microsoft\\MicrosoftSDK\\InstalledSDKS\\D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1\\Install



> Dir'



> MSCommon/sdk.py: trying to find SDK 2003R1



> find_sdk_dir(): checking



> registry:Software\Microsoft\MicrosoftSDK\InstalledSDKS\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3\Install



> Dir



> find_sdk_dir(): no SDK registry key



> 'Software\\Microsoft\\MicrosoftSDK\\InstalledSDKS\\8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3\\Install



> Dir'



> vc.py:msvc_find_valid_batch_script() vc_script:C:\Program Files



> (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat sdk_script:None



> vc.py:msvc_find_valid_batch_script() use_script 2 u'C:\\Program Files



> (x86)\\Microsoft Visual Studio 10.0\\VC\\vcvarsall.bat', args:amd64



>



> Calling 'C:\Program Files (x86)\Microsoft Visual Studio



> 10.0\VC\vcvarsall.bat amd64'



> ADDED BY ASEEM: RAISE IOERROR, popen.wait != 0



> IOError: :



> File "E:\scons-test\SConstruct", line 1:



> env = Environment()



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Environment.py",



> line 1002:



> apply_tools(self, tools, toolpath)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Environment.py",



> line 106:



> env.Tool(tool)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Environment.py",



> line 1786:



> tool(self)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\__init__.py",



> line 183:



> self.generate(env, *args, **kw)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\default.py",



> line 41:



> SCons.Tool.Tool(t)(env)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\__init__.py",



> line 183:



> self.generate(env, *args, **kw)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\mslink.py",



> line 303:



> msvc_setup_env_once(env)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\vc.py",



> line 351:



> msvc_setup_env(env)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\vc.py",



> line 444:



> d = msvc_find_valid_batch_script(env,version)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\vc.py",



> line 398:



> d = script_env(vc_script, args=arg)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\vc.py",



> line 299:



> stdout = common.get_output(script, args)



> File



> "C:\Python27\Scripts\..\Lib\site-packages\scons-2.3.0\SCons\Tool\MSCommon\common.py",



> line 176:



> raise IOError(stderr.decode("mbcs"))



>



>



>



>



> ------------------------------



> Date: Tue, 4 Feb 2014 08:35:47 -0500



>



> From: kri80vt at outlook.com



> To: kri80vt at outlook.com



> Subject: Re: [Scons-users] Help regarding IOError(stderr.decode("mbcs"))



>



> OK, try setting the system environment variable SCONS_MSCOMMON_DEBUG=-



> (that's a dash as the value) before running SCons; it should spit out a



> bunch of stuff. Whatever the last thing it says it's calling there (should



> be a Visual Studio bat file) is probably the thing causing the trouble.



> Looking at the code, it may not be anything to do with multibyte decoding;



> it may be the bat file subprocess returning an error.



>



> Also I think you may be running a slightly older SCons, given the line



> numbers in your original post. Make sure you're running 2.3.0 and it still



> happens there.



>



>



> On Tue, Feb 4, 2014 at 7:26 AM, Aseem Shakuntal <kri80vt at outlook.com>wrote:



>



>



> Hi Gary,



>



> My system locale is: en-us;



>



> E:\>systeminfo /FO LIST | find "System Locale"



> System Locale: en-us;English (United States)



>



> Br, Aseem



> ------------------------------



> Date: Tue, 4 Feb 2014 07:14:45 -0500



> From: kri80vt at outlook.com



>



> To: kri80vt at outlook.com



> Subject: Re: [Scons-users] Help regarding IOError(stderr.decode("mbcs"))



>



> What is your locale? Looks like it's trying to decode a multibyte string



> coming from stderr.



>



> --



> Gary Oberbrunner



> (sent from my Android)



> On Feb 4, 2014 7:08 AM, "Aseem Shakuntal" <kri80vt at outlook.com> wrote:



>



> Hello,



>



> In order to get started with scons, I created a simple "hello.c" and a



> SConstruct file which does this:



>



> env = Environment()



> hello = Program(["hello.c"])



>



> When I run scons from my folder which contains these files, I get this



> error:



>



> $ scons



> scons: Reading SConscript files ...



> IOError: :



> File "E:\scons-test\SConstruct", line 1:



> env = Environment()



> File "c:\Python27\scons-2.0.1\SCons\Environment.py", line 991:



> apply_tools(self, tools, toolpath)



> File "c:\Python27\scons-2.0.1\SCons\Environment.py", line 105:



> env.Tool(tool)



> File "c:\Python27\scons-2.0.1\SCons\Environment.py", line 1692:



> tool(self)



> File "c:\Python27\scons-2.0.1\SCons\Tool\__init__.py", line 180:



> self.generate(env, *args, **kw)



> File "c:\Python27\scons-2.0.1\SCons\Tool\default.py", line 41:



> SCons.Tool.Tool(t)(env)



> File "c:\Python27\scons-2.0.1\SCons\Tool\__init__.py", line 180:



> self.generate(env, *args, **kw)



> File "c:\Python27\scons-2.0.1\SCons\Tool\mslink.py", line 242:



> msvc_setup_env_once(env)



> File "c:\Python27\scons-2.0.1\SCons\Tool\MSCommon\vc.py", line 343:



> msvc_setup_env(env)



> File "c:\Python27\scons-2.0.1\SCons\Tool\MSCommon\vc.py", line 436:



> d = msvc_find_valid_batch_script(env,version)



> File "c:\Python27\scons-2.0.1\SCons\Tool\MSCommon\vc.py", line 390:



> d = script_env(vc_script, args=arg)



> File "c:\Python27\scons-2.0.1\SCons\Tool\MSCommon\vc.py", line 292:



> stdout = common.get_output(script, args)



> File "c:\Python27\scons-2.0.1\SCons\Tool\MSCommon\common.py", line 173:



> raise IOError(stderr.decode("mbcs"))



>



> I am using windows 7, 64 bit. I have python 2.7 installed (and also python



> 3.2).



>



> Can anyone point me to fixing this? Any help / pointers are highly



> appreciated!



>



> Br, Aseem



> --



> i must dream, to make my dreams come true!



>



> _______________________________________________



> Scons-users mailing list



> kri80vt at outlook.com



> http://four.pairlist.net/mailman/listinfo/scons-users



>



>



> _______________________________________________ Scons-users mailing list



> kri80vt at outlook.com



> http://four.pairlist.net/mailman/listinfo/scons-users



>



> _______________________________________________



> Scons-users mailing list



> kri80vt at outlook.com



> http://four.pairlist.net/mailman/listinfo/scons-users



>



>



>



>



> --



> Gary



>



> _______________________________________________ Scons-users mailing list



> kri80vt at outlook.com



> http://four.pairlist.net/mailman/listinfo/scons-users



>



> _______________________________________________



> Scons-users mailing list



> kri80vt at outlook.com



> http://four.pairlist.net/mailman/listinfo/scons-users



>



>



>



>



> --



> Gary



>



> _______________________________________________ Scons-users mailing list



> kri80vt at outlook.com



> http://four.pairlist.net/mailman/listinfo/scons-users



>



> _______________________________________________



> Scons-users mailing list



> kri80vt at outlook.com



> http://four.pairlist.net/mailman/listinfo/scons-users



>



>






--



Gary






_______________________________________________
Scons-users mailing list
Scons-users at scons.org
http://four.pairlist.net/mailman/listinfo/scons-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20140205/9de100c8/attachment-0001.htm
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: scons-error.txt
Url: http://four.pairlist.net/pipermail/scons-users/attachments/20140205/9de100c8/attachment-0001.txt


More information about the Scons-users mailing list