这是用于Windows Intellij。
当我用下面两行运行一个简单的python程序时,它会出错:
# !/usr/bin/python
print("testing")
错误:
C:\Users\name\AppData\Local\Programs\Python\Python36\python.exe C:/Users/name/IdeaProjects/projectName/src/main/resources/pythonlib/test.py
Fatal Python error: Py_Initialize: unable to load the file system codec
Traceback (most recent call last):
File "<frozen importlib._bootstrap_external>", line 1096, in _path_importer_cache
KeyError: 'C:\\Users\\name\\.m2\\repository\\info\\cukes\\cucumber-java\\1.2.2\\cucumber-java-1.2.2.jar'
我已经设置了环境变量PYTHONHOME,PYTHONPATH并添加了路径。
这是一个maven项目,并在src / main / resources / pythonlib下创建了python文件。
请帮忙。
答案 0 :(得分:0)
请尝试以下插件配置:
private void getAppData(){
//Creating a string request
StringRequest stringRequest = new StringRequest(URLAddress.SHOW_ALL_APK,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
JSONObject j = null;
try {
JSONObject json = new JSONObject(response);
JSONArray jsonArr = json.getJSONArray("files");
for (int i = 0; i < jsonArr.length(); i++) {
j = jsonArr.getJSONObject(i);
appList.add( j.toString() );
}
} catch (JSONException e) {
e.printStackTrace();
}
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
//Creating a request queue
RequestQueue requestQueue = Volley.newRequestQueue(this);
//Adding request to the queue
requestQueue.add(stringRequest);
}