chaquopy

PyException: ImportError: No module named domreg

跟風遠走 提交于 2019-12-13 09:46:51
问题 I am getting the below error while running this script ( "from xml.dom import minidom" ) from chaquopy androi application python console. PyException: ImportError: No module named domreg 回答1: There was a bug which prevented implicit relative imports from working with the import hook enabled. This has been fixed in version 0.4.4 which is available now (https://github.com/chaquo/chaquopy/issues/12). 来源: https://stackoverflow.com/questions/46885861/pyexception-importerror-no-module-named-domreg

What directory does chaquopy code search for the Python packages which are imported in the Python code of the Android app code

我的梦境 提交于 2019-12-12 18:27:29
问题 I have imported nltk library in my main method of the Python code of the chaquopy Android app. It is asking me to implement nltk.download('punkt') for my processing. So I wanted to know: in what directory does the code look for the packages, so that I can download a copy of them in the desired folder for my code to work right? Edit : I implemented the solution provided by @mhsmith, but nltk.download('punkt') is still giving Lookup Error. Screenshots are attached: The first line is the

How to display python matplotlib graphs (png) with Chaquopy in Android Studio

假装没事ソ 提交于 2019-12-11 03:15:38
问题 So I use chaquopy to get simple python programs functioning in an old (jelly bean) tablet (I replace the example console app's main.py in the src directory). Not bad for a beginner's start and I'm very happy. But now for a test I try to display a matplotlib graph like this: import matplotlib.pyplot as plt import matplotlib.image as mpimg def main(): image = mpimg.imread("/storage/emulated/0/Documents/test.png") plt.imshow(image) plt.show() The matplotlib library was installed from within

How to configure Python interpretor in android studio

北慕城南 提交于 2019-12-10 13:17:47
问题 I am trying to se python in android studio as a backend code for working on variables and producing answer. My MainActivity is in Java and a directory is created for python code. when I try to write code in python is tells that "no python interpreter configured for the module" I have added Chaquopy and Python Community Plugin. Also I want to know how can I send variables for my MainActivity to python and viceversa. I am trying to add python in android studio. I have tried Chaquopy and also

How to convert an opencv Mat into a numpy.ndarray?

做~自己de王妃 提交于 2019-12-02 03:53:42
I have a code written in java (android) that open the camera of the phone and show frames. The below code represents the method in which we can retrieve frames. The project used Chaquopy to interpret python code. @Override public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) { mRgba = inputFrame.rgba(); Python py = Python.getInstance(); PyObject pym = (PyObject) py.getModule("MyPythonClass").callAttr("call",mRgba); return mRgba; } The python code is used to retrieve the frame (represented by "mRgba" which is a Mat in the java code) for further treatment The problem is to