我一直在研究STAF 和 STAX。我的目标是使用 STAF & STAX Return Testcase PASS或FAIL读取JSON文件。我尝试使用最新的 python 版本将我的员工更新到最新版本。
Python 版本详情
20130408-15:38:19
Python Version : 2.5.2 (Release_2_5_2:7206, Mar 2 2011, 23:12:06)
[Java HotSpot(TM) Client VM (Sun Microsystems Inc.)]
这是我的代码:
try:
import simplejson as json
except ImportError:
import json
title = []
album = []
slist = []
json_data=open('d:\Json_File.txt')
data = json.load(json_data)
for i in range(data["result"].__len__()):
title = data["result"][i]["Title"]
album = data["result"][i]["Album"]
slist = data["result"][i]["Title"] + ' [' + data["result"][i]["Album"] + '] \n'
它给出了下面给出的错误
20130408-11:32:26 STAXPythonEvaluationError signal raised. Terminating job.
===== XML Information =====
File: new13.xml, Machine: local://local
Line 15: Error in element type "script".
===== Python Error Information =====
com.ibm.staf.service.stax.STAXPythonEvaluationException:
Traceback (most recent call last):
File "<pyExec string>", line 1, in <module>
ImportError: No module named simplejson
===== Call Stack for STAX Thread 1 =====[
function: main (Line: 7, File: C:\STAF\services\stax\samples\new13.xml, Machine: local://local)
sequence: 1/2 (Line: 14, File: C:\STAF\services\stax\samples\new13.xml, Machine: local://local)
]
在 STAF 模块中包含 JSON 的过程是什么。