Monday, February 22, 2010

Scons: TypeError: coercing to Unicode: need string or buffer, NoneType found

Scons on cygwin 1.7.1 when invoked remotely through ssh throws an error as:
TypeError: coercing to Unicode: need string or buffer, NoneType found

Error above is a common python error which occurs when one create a dictionary object(key,value) list with one or more keys with value as "None". We have to ensure that all the keys are having value to fix the above error.

Scons run without any failure when invoked being on cygwin 1.7.1 shell environment but fails with the TypeError as above in our case when invoked remotely through ssh.

Scons TypeError is as a result of USERPROFILE variable not getting set. Once USERPROFILE is set explicitly from .bashrc, scons run successfully.
As evident from the python error USERPROFILE was having value as "None", by setting appropriate value will resolve the issue.

USERPROFILE default value on WINNT is C:\Document And Settings\, it is always better to set value as default in .bashrc with an entry as
export USERPROFILE="C:\Documents and Settings\build"
build is the user logged in in our case.

We had issues with other application run on cygwin bash shell when we had some junk/non-default value set to USERPROFILE. We had issues running BullsEye code coverage tool with non-default value.
BullsEye failed with an error as "Exception: SHGetFolderPath failure". Default USERPROFILE value in .bashrc fixed the BullsEye failure.

cheers,
make world open.

3 comments:

Anonymous said...

love it.

RXG said...

thanks a lot...been wasting hours on this stuff!

RXG said...

thanks a lot...wasted hours on this problem