Skip to content

Commit 8ae6cf6

Browse files
committed
PyInterpreter is updated
1 parent 18b904b commit 8ae6cf6

18 files changed

+6
-205
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.DS_Store

.idea/compiler.xml

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/runConfigurations.xml

-10
This file was deleted.

src/main/java/Python/PyInterpreter.java

+4-15
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,12 @@
55
public class PyInterpreter {
66
public void execPy(String pyFile){
77
try {
8-
String command = "cmd /c python "+System.getProperty("user.dir")+"\\src\\main\\resources\\"+pyFile;
8+
String command = "python3 "+System.getProperty("user.dir")+"/src/main/resources/"+pyFile;;
9+
String osName = System.getProperty("os.name").toLowerCase();
10+
if(osName.contains("windows"))
11+
command = "cmd /c python3 "+System.getProperty("user.dir")+"\\src\\main\\resources\\"+pyFile;
912
Process p = Runtime.getRuntime().exec(command);
1013
p.waitFor();
11-
BufferedReader bri = new BufferedReader(new InputStreamReader(p.getInputStream()));
12-
BufferedReader bre = new BufferedReader(new InputStreamReader(p.getErrorStream()));
13-
String line;
14-
while ((line = bri.readLine()) != null) {
15-
System.out.println(line);
16-
}
17-
bri.close();
18-
while ((line = bre.readLine()) != null) {
19-
System.out.println(line);
20-
}
21-
bre.close();
22-
p.waitFor();
23-
System.out.println("Done.");
24-
2514
p.destroy();
2615
}
2716
catch (Exception e){
Binary file not shown.
Binary file not shown.
Binary file not shown.

target/classes/App.class

-4.96 KB
Binary file not shown.

target/classes/App2.class

-4.99 KB
Binary file not shown.
Binary file not shown.
-3.12 KB
Binary file not shown.
-309 Bytes
Binary file not shown.
-795 Bytes
Binary file not shown.
Binary file not shown.

target/classes/GraphForAHundred.py

-139
This file was deleted.

target/classes/GraphForAMillion.py

-41
This file was deleted.
-1.99 KB
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)