Jul-20-2017, 02:14 AM
Hi,
it's continuing my last question,
when I run my script on pure python, its works well and no error appeared.
but, when I tried to run it from java (using jython) it shows ImportError: No module named pymysql in case it's works on python.
daftar_po.java
it's continuing my last question,
when I run my script on pure python, its works well and no error appeared.
but, when I tried to run it from java (using jython) it shows ImportError: No module named pymysql in case it's works on python.
daftar_po.java
Quote:String ram = "0005/07/2017";
String dat[] = {ram};
PythonInterpreter.initialize(System.getProperties(), System.getProperties(), dat);
org.python.util.PythonInterpreter py = new org.python.util.PythonInterpreter();
StringWriter out = new StringWriter();
String sln = "python/process.py";
py.execfile(sln);
String strOut = out.toString();
System.out.println(strOut);
import sys sys.path.append("D:\AvosLab\digital_scale\python") from key import db, base db = db base = base def aFunc(arg1): base.execute("select num from tbl_a where KodeForm=%s",(arg1)) hsl = base.fetchall() words = [row[0] for row in hsl] num_text = ','.join(words) max_val = max([int(x) for x in num_text.split(',')]) print(max_val) aFunc(sys.argv[0])key.py
import sys sys.path.append("D:\AvosLab\digital_scale\python") import pymysql db = pymysql.connect(host="192.1.1", user="user", passwd="pass123", db="tbl_a") base = db.cursor()
Error:Exception in thread "AWT-EventQueue-0" Traceback (most recent call last):
File "python/process.py", line 3, in <module>
from key import db, base
File "D:\AvosLab\digital_scale\python\key.py", line 3, in <module>
import pymysql
ImportError: No module named pymysql
tell me if I am not allowed to post another programming language here, but I am very satisfied to this forum that answer my questions correctly.