Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lizard script doesn't working with jython in springboot applicatoion #367

Open
pawan-panwar opened this issue Dec 9, 2022 · 0 comments
Open

Comments

@pawan-panwar
Copy link

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 -

org.python
jython-standalone
2.7.3

@pawan-panwar pawan-panwar changed the title Lizard script doesn't worki with jython in springboot applicatoion Lizard script doesn't working with jython in springboot applicatoion Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant