我想使用 pyjs 作为我已经构建和测试过的应用程序的接口。它使用外部库,包括 MySQLdb。我希望我可以将它与 pyjs 很好地集成,但一直收到错误消息
ImportError: No module named MySQLdb, MySQLdb in context None
现在,当我在没有 pyjs 的情况下运行程序时,我没有收到此错误并且一切正常。但即使只是一个像这样的简单 pyjs 脚本
from pyjamas.ui.Button import Button
from pyjamas.ui.RootPanel import RootPanel
from pyjamas.ui.HTML import HTML
from pyjamas.ui.HorizontalPanel import HorizontalPanel
import MySQLdb
def run_fcm(sender):
db=MySQLdb.connect(host="00.00.00.00", port=0000, user="user_name", passwd="pwd", db="db_name")
if __name__=='__main__':
input_header=HTML('Input')
generate_prediction=Button("Generate Prediction", run_fcm)
RootPanel().add(input_header)
RootPanel().add(generate_prediction)
给我上面提到的错误。
我怎样才能以这种方式使用 MySQLdb,或者,如果我不能,是否有一个简单的替代方案?我觉得从这篇文章中应该是可能的。我可以让 pyjs 处理不使用 MySQLdb 的示例。现在,我只是在我的本地机器上开发。