UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 10: ordinal not in range(128)

Robin Siebler robin.siebler at palmsource.com
Fri Oct 8 01:40:21 CEST 2004


I have no idea what is causing this error, or how to fix it.  The full error is:

Traceback (most recent call last):
  File "D:\ScriptRuntime\PS\Automation\Handlers\SCMTestToolResourceToolsBAT.py",
 line 60, in Run
    PS.Automation.Utility.System.AppendSystemPath(args["PATH"], context)
  File "D:\ScriptRuntime\PS\Automation\Utility\System.py", line 55, in AppendSys
temPath
    AppendPathVariable("PATH", appendtext, context)
  File "D:\ScriptRuntime\PS\Automation\Utility\System.py", line 37, in AppendPat
hVariable
    if(ap == pp):
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa0 in position 10: ordinal
 not in range(128)

The code for the function is:

def AppendPathVariable(variable, appendtext, context):
	"""AppendSystemPath(appendtext, context) -> None
	
		Appends a directory string to the system path. The string can be
	as single path or multiple paths seperated by a semi-colon."""
	
	if(os.environ.has_key(variable)):
		curpath = os.environ[variable]
		
		pathparts = string.split(curpath, ";")
		appendparts = string.split(appendtext, ";")
		
		for ap in appendparts:
			found = 0
			
			for pp in pathparts:
				if(ap == pp):
					found = 1
			
			if(found == 0):
				pathparts.append(ap)
			#end for ap in appendparts
		
		newpath = string.join(pathparts, ";")
		os.environ[variable] = newpath
	else:
		os.environ[variable] = appendtext



More information about the Python-list mailing list