public void result() {
StringWriter output = new StringWriter();
PythonInterpreter pyInterp = new PythonInterpreter();
pyInterp.setOut(output);
pyInterp.exec("import sys");
pyInterp.exec("sys.path.append('/Users/abcd/Desktop/lizard_code/lizard-1.17.10/')");
pyInterp.exec("import lizard");
pyInterp.exec("i = lizard.analyze_file(\"/Users/abcd/Desktop/lizardcdb_code/test.java\")");
pyInterp.exec("s = i.dict.getitem(\"function_list\")");
PyObject x = pyInterp.get("s");
System.out.println(x.getitem(0).getDict().finditem("cyclomatic_complexity"));
}
While using the above code in normal java class its working fine and when we run this code using spring boot application its throw below error-
Traceback (most recent call last):
File "script.py", line 4, in
i = lizard.analyze_file("/Users/abcd/Desktop/lizard_code/test.java")
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard.py", line 546, in call
return self.analyze_source_code(
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard.py", line 546, in call
return self.analyze_source_code(
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard_ext/auto_open.py", line 0, in auto_read
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard_ext/auto_open.py", line 0, in auto_read
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard_ext/auto_open.py", line 21, in auto_open
size = min(32, os.path.getsize(args[0]))
AttributeError: 'javapackage' object has no attribute 'open'
public void result() { StringWriter output = new StringWriter(); PythonInterpreter pyInterp = new PythonInterpreter(); pyInterp.setOut(output); pyInterp.exec("import sys"); pyInterp.exec("sys.path.append('/Users/abcd/Desktop/lizard_code/lizard-1.17.10/')"); pyInterp.exec("import lizard"); pyInterp.exec("i = lizard.analyze_file(\"/Users/abcd/Desktop/lizardcdb_code/test.java\")"); pyInterp.exec("s = i.dict.getitem(\"function_list\")"); PyObject x = pyInterp.get("s"); System.out.println(x.getitem(0).getDict().finditem("cyclomatic_complexity"));
While using the above code in normal java class its working fine and when we run this code using spring boot application its throw below error-
Traceback (most recent call last): File "script.py", line 4, in
i = lizard.analyze_file("/Users/abcd/Desktop/lizard_code/test.java")
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard.py", line 546, in call
return self.analyze_source_code(
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard.py", line 546, in call
return self.analyze_source_code(
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard_ext/auto_open.py", line 0, in auto_read
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard_ext/auto_open.py", line 0, in auto_read
File "/Users/abcd/Desktop/lizard_code/lizard-1.17.10/lizard_ext/auto_open.py", line 21, in auto_open
size = min(32, os.path.getsize(args[0]))
AttributeError: 'javapackage' object has no attribute 'open'
Jython dependency -