Python Forum
ImportError: No module named pymysql
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ImportError: No module named pymysql
#1
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
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.
Reply
#2
As your script runs in python, this is not a python error.
Hoever running in jyphon the module not found error is described in section 4.1 of the jyphon FAQ:

http://www.jython.org/archive/22/userfaq...-supported

You may be unlucky here and have picked a python module that is not in the jyphon library.
Unless someone has an another idea you may have to contact the jyphon team
Reply
#3
is there a pip equivalent in jpython? if so perhaps you can install: https://pypi.python.org/pypi/PyMySQL/0.7.11
Reply
#4
(Jul-20-2017, 08:04 PM)cygnus_X1 Wrote: As your script runs in python, this is not a python error.
Hoever running in jyphon the module not found error is described in section 4.1 of the jyphon FAQ:

http://www.jython.org/archive/22/userfaq...-supported

You may be unlucky here and have picked a python module that is not in the jyphon library.
Unless someone has an another idea you may have to contact the jyphon team

so the problem is I am just unlucky? hahahah...
I think I'll go to the fortune teller next time..
haha

(Jul-20-2017, 08:47 PM)Larz60+ Wrote: is there a pip equivalent in jpython? if so perhaps you can install: https://pypi.python.org/pypi/PyMySQL/0.7.11

I've installed it,
Pray
and, the same error appeared

Can you tell me,
what should I use to connect into mysql except using pymysql?
if pymysql is not possible..
Reply
#5
I'd do a serach on pypi https://pypi.python.org/pypi
I use PostgreSQL, so not too familiar with the MySQL packages.
Choose one that has a high weight.
perhaps: https://pypi.python.org/pypi/mysql/0.0.1
Reply
#6
(Jul-22-2017, 02:22 AM)Larz60+ Wrote: I'd do a serach on pypi https://pypi.python.org/pypi
I use PostgreSQL, so not too familiar with the MySQL packages.
Choose one that has a high weight.
perhaps: https://pypi.python.org/pypi/mysql/0.0.1

it's just for py 2.7, and use py 3.x
Reply
#7
certainly one of these will do
https://pypi.python.org/pypi?%3Aaction=s...mit=search
Reply
#8
(Jul-24-2017, 03:24 AM)Larz60+ Wrote: certainly one of these will do
https://pypi.python.org/pypi?%3Aaction=s...mit=search

I will try it one by one.
Reply
#9
Quote:I will try it one by one.
You don't need to do that. Open each up in pypi and read it's capibilities.
choose one that has a high weight (based on update activity and number if downloads).
It's not a bad guide.
If you find one that seems to fit, then give it a go.
Also if it's been around for a while, look in nullege.com for some working examples and see how it's used.
Perhaps even go to the github location and take a look at what's available, as there may be more information available there
Reply
#10
(Jul-24-2017, 10:57 AM)Larz60+ Wrote:
Quote:I will try it one by one.
You don't need to do that. Open each up in pypi and read it's capibilities.
choose one that has a high weight (based on update activity and number if downloads).
It's not a bad guide.
If you find one that seems to fit, then give it a go.
Also if it's been around for a while, look in http://nullege.com for some working examples and see how it's used.
Perhaps even go to the github location and take a look at what's available, as there may be more information available there 

OK, thanks... I am still look for that
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020