[英]Run python script in intellij using kotlin
I have an assignment to do and i need to create a server in kotlin using intellij.我有一项任务要做,我需要使用 intellij 在 kotlin 中创建一个服务器。 I need to create a function that execute a python (TheHarvester lib in github) script but with out success.
我需要创建一个函数来执行 python(github 中的 TheHarvester lib)脚本,但没有成功。 Note: I have installed the python plugin.
注意:我已经安装了python插件。
Here is the code:这是代码:
fun executeScript() : String {
val process = Runtime.getRuntime().exec(
"../resources/theHarvester/theHarvester.py"
)
process.waitFor()
val reader = BufferedReader(InputStreamReader(process.inputStream))
val message = reader.lines().collect(Collectors.joining("\n"))
println(message)
return ""
}
And here is the error message:这是错误消息:
2020-02-06 21:14:21.998 [main] INFO Application - No ktor.deployment.watch patterns specified, automatic reload is not active
2020-02-06 21:14:23.885 [main] INFO Application - Responding at 0.0.0.0:8081
2020-02-06 21:14:26.089 [nettyCallPool-4-1] ERROR Application - 200 OK: GET - /execute
java.io.IOException: Cannot run program "../resources/theHarvester/theHarvester.py": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
文件theHarvester.py
很可能没有操作系统的可执行权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.