part of my code is as following:
i want to decode a korean fie to utf8 ,so i can post it to the remote server. i validate the script correctly,but when i run in after runing the agent ,it declare errors as such:
net.grinder.scriptengine.jython.JythonScriptExecutionException: LookupError: no codec search functions registered: can't find encoding
File "/home/wangsl/.ngrinder_agent/file-store/current/d2c.py", line 40, in __call__
2013-12-15 14:04:42,331 ERROR samsung003-PowerEdge-R720-0 thread-0 [ run-1 ]: Aborted run: Jython exception: LookupError: no codec search functions registered: can't find encoding [calling TestRunner]
May it because there's no function decode in jython, i wonder whether the python lib can or not use in jython ?
who Know about this,ask for help!
def __call__(self):
url = "
http://109.105.7.101:8180/X2CDemo/x2cdemo201312/classifyD2CKR.action"
url_file = "./resources/13150"
file = open(url_file,"r")
title = file.readline().decode('utf8')
grinder.logger.info(title)
line = file.readline()
content = ''
while line:
content += line
line = file.readline()
file.close()
content = content.decode('utf8')
grinder.logger.info(content)
params = [NVPair("title", title),NVPair("content", content),NVPair('Content-Type', 'application/x-www-form-urlencoded')]
result = test2(url,params)
grinder.logger.info(result.getText())