Git Product home page Git Product logo

qpython-android / qpython Goto Github PK

View Code? Open in Web Editor NEW
1.0K 98.0 190.0 144.58 MB

QPython is an Android Python engine primarily designed for Python and AI learners. It offers a range of impressive features to enhance Python programming experience.

Home Page: https://www.qpython.org

JavaScript 0.06% Java 97.62% HTML 0.14% CSS 0.16% Makefile 0.03% C++ 0.63% C 0.18% Shell 0.01% Jupyter Notebook 0.01% AIDL 1.18%
ai android generative-ai python

qpython's Introduction

About

Welcome to the QPython project!

QPython is the Python engine for android. It contains some amazing features such as Python interpreter, runtime environment, editor and QPYI and integrated SL4A. It makes it easy for you to use Python on Android. And it's FREE.

Compared with other Python apps, QPython mainly solves how to use Python to drive your Android device work. Good SL4A support is our main goal, such as android's camera, sensor, sms media APIs etc.

QPython already has millions of users worldwide and it is also an open source project.

For different usage scenarios, QPython has two branches, namely QPython Ox and 3x.

QPython Ox is mainly aimed at programming learners, and it provides more friendly features for beginners. QPython 3x is mainly for experienced Python users, and it provides some advanced technical features.

Quick start

This repository is the QPython Ox project repository, you can follow the below steps to run it.

  • Macos + Android studio, (Ubuntu may work too)
  • git clone [email protected]:qpython-android/qpython.git
  • git submodule init
  • git submodule sync
  • git submodule update
  • build it...

Get more information from wiki for developing QPython

Related

How to ask QPython related questions

In order to benefit those guys who have the same issue with QPython, we suggest that you should ask the issue which is related with QPython within public techical communities.

English QPythonista Community

Chinese QPythonista Community

  • Wechat Group: Please scan the following qrcode with your wechat

Report issues

Please tell us your phone's informatioin, android os information, QPython branch, and your code, where did you install it and the detailed stituation you have encountered.

THANK YOU.

qpython's People

Contributors

gitter-badger avatar kylelk avatar liyuanrui avatar magich0le avatar pan93412 avatar pollyfat avatar quseit-bin avatar riverfor avatar sharletk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qpython's Issues

No AssertionError

Version 1.1.0
Android O

Test Code:

assert 2 == 3
print(4)

Expected result:

AssertionError

Actual result:

4

可以让脚本注册成一个intent吗?

您好,我想将脚本的界面做成一个intent,想在别的app中通过share文字,至qpython脚本制作的界面,请问可以实现吗?谢谢。

研究了一下,好像有api可以makeIntent,然后startActivity?求教作者大大,再次感谢!

Force Android garbage collector

Is there a way to force the Android garbage collector to free unused memory (I need it before executing a memory intensive operation)?

If not, please add it.

Loses wakelock and wifilock on android tablet

Hi,

Installed qpython from google playstore on my samsung gt-p7510 running android 4.0.4.

I am running a long running python script from the programs tab in qpython. I select both TakeWakeLock and TakeWifiLock and leave my tab on with wifi.

However after some time If I do not do any activity on the tab both locks drop which causes my script to fail since it drops wifi. When I unlock my tab I find that the locks have been dropped and now I see TakeWakeLock and TakeWifiLock again.

If however I do some activity on my tab after every 10 - 15 mins then the locks are not dropped.

I have set my tab to screen timeout after 15 mins of inactivity.

Please help

Missing bz2 module

While I'm trying to install some package by pip, I got an error that missing the bz2 module.

Ffplay missing

Running a py script for gopro session streaming showed ffplay missing error.
Where do i find the missing file?

screenshot_20170813-095511

Bluetooth couldn't connect to SPP

Bluetooth fasade couldn't connect to SPP device. I am trying to port my software from old sl4a version to qpython. The part of code is very simple

import androidhelper as android
dr = android.Android()
print dr.toggleBluetoothState(True)
print dr.bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB')

The last line should ask me to choose MAC of BT device but nothing happens and function returns imidiately. The output of this code is as follows.

/data/user/0/org.qpython.qpy/files/bin/qpython-android5.sh "/storage/emulated/0/qpython/scripts/bt.py" && exit
.sh "/storage/emulated/0/qpython/scripts/bt.py" && exit                    <
Result(id=1, result=True, error=None)
Result(id=2, result=None, error=None)

#[QPython] Press enter to exit

The sl4a version r6.1.1 with python 2.7 Bin:29 Extra:29 works fine with this code on the same android device.

Thank you in advance for any help.

not executable: magic 7F45

With QPython 2.0.5 when I try to open a script I get:

u0_a38@klte:/ $ /data/data/org.qpython.qpy/files/bin/qpython.sh && exit
/data/data/org.qpython.qpy/files/bin/qpython.sh[3]: /data/data/org.qpython.qpy/files/bin/python: not executable: magic 7F45
1|u0_a38@klte:/ 

Porting Keras to QPython

Hello,

According to this tweet you are porting Theano for qpython. It would be a great idea if you ported keras (python framework built on popular ML toolkits) to qpython. That will make prototyping mobile applications that involve neural networks much easier to prototype!

Thanks in advance

ftp's chroot issue

When using ftp's ls command,

"The files and/or directories are protected too strongly.
So, the ftp client is not really useable at the moment."

Please check that
screenshot from 2017-08-25 12-49-36

“CANNOT LINK EXECUTABLE” error

Hello guys!
I need some help with a QPython script.
Do you mind taking a look at: http://stackoverflow.com/questions/43778749/cannot-link-executable-error-with-qpython ?

Thanks.


I'm trying to build a simple Telegram bot to start and stop an old Samsung device working as a security cam.

All is good via ssh, so the commands involved have been already proved to be working. It's now a matter of moving them to QPython and the python-telegram-bot lib.

Also the bot is already working, running from the device itself. The problem are the commands involving shell calls, as this one (QPython shell is running with root privileges):

am start -n com.pas.webcam/.Rolling

This should open the IP Webcam app.
In the QPython's script or console, if I do:

>>> from subprocess import call
>>> call(['/system/bin/am', 'start', '-n', 'com.pas.webcam/.Rolling'])

...I have the error:

CANNOT LINK EXECUTABLE "app_process": \
cannot locate symbol "jpeg_crop_scanline" referenced by "/system/lib/libskia.so"...

...with exit code -6

From what I understand, there's a problem with a library when the IP webcam app is opened from the QPython shell. I cannot find any reference to similar issues.

Any idea on how can I fix this?
Thanks.


Console

How can I install a Lib By console?

Sent from my Motorola XT1069 using FastHub

Add a license

I'd like to add QPython to the FDroid RePo but there's no license mentioned, so it would be hard/impossible to get it through.

Kivy OSC problem

Problem:
Can't use kivy OSC lib in Qpython
This simple code will raise error:

#qpy:kivy
from kivy.lib import osc
osc.init()
oscid = osc.listen(port=3002)
Traceback (most recent call last):
  File "main.py", line 4, in main
    oscid = osc.listen(port=3002)
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/kivy_qpython-1.10.0-py2.7.egg/kivy/lib/osc/oscAPI.py", line 245, in listen
    oscThreads[thread_id] = OSCServer(ipAddr=ipAddr, port=port)
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/kivy_qpython-1.10.0-py2.7.egg/kivy/lib/osc/oscAPI.py", line 190, in __init__
    super(OSCServer, self).__init__()
  File "/data/user/0/org.qpython.qpy/files/lib/python2.7/site-packages/kivy_qpython-1.10.0-py2.7.egg/kivy/lib/osc/oscAPI.py", line 69, in __init__
    self.queue = Queue()
  File "/data/user/0/org.qpython.qpy/files/lib/python27.zip/multiprocessing/__init__.py", line 218, in Queue
    return Queue(maxsize)
  File "/data/user/0/org.qpython.qpy/files/lib/python27.zip/multiprocessing/queues.py", line 63, in __init__
    self._rlock = Lock()
  File "/data/user/0/org.qpython.qpy/files/lib/python27.zip/multiprocessing/synchronize.py", line 147, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1)
  File "/data/user/0/org.qpython.qpy/files/lib/python27.zip/multiprocessing/synchronize.py", line 75, in __init__
    sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue)
OSError: [Errno 38] Function not implemented

Inclusion in F-Droid

Now that all the repositories have licences, we can request it be included in F-Droid.

I did so a few minutes ago, here is the link to the ticket:
https://gitlab.com/fdroid/rfp/issues/239

There will likely be questions about the inclusion, around things including pre-built libraries (if any), build scripts, update methods and so on. Your assistance answering questions would be appreciated.

Cheers

Special Keys

Special Keys dont seem to work well on Android 6.0 One Plus 3

Camera not support

Downloaded QPython3 from Google Play store and attempted to use in-app QR reader. 'camera not support' toast popped up despite the app having camera permissions.

Device:
Android: 7.0
API: 24
Device: samsung SM-G930T
Camera: s5k4e6xx

Not sure if this correct outlet for these types of reports but here you go and thanks for making a great app!

Text disappear in RTL languages

When the system is on RTL (Right To Left) languages like Hebrew or Arabic, Because of the alignment to the right, the text in the QPYPI window is not shown, as you can see in the screenshot below.
screenshot_20170817-001814

Console not work

Samsung J3 (2016)
In the console, the button delete and enter not work, to push in this
Do not delete characters, and do not read the line. The other characters
Work ok (a-z 0-9 Ctrl Shift ... etc).

Copy console:
/data/data/org.qpython.qpy3/files/bin/qpython-android5.sh && exit
/qpython-android5.sh && exit <
WARNING: linker: zlib.cpython-32m.so: unused DT entry: type 0x6ffffffe arg 0x8a4
WARNING: linker: zlib.cpython-32m.so: unused DT entry: type 0x6fffffff arg 0x1
Python 3.2.2 (default, Jun 18 2015, 19:03:02)
[GCC 4.9 20140827 (prerelease)] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
WARNING: linker: libreadline.so.6: unused DT entry: type 0x1d arg 0x316a

Qpython error code i dont know what to do

/data/user/0/org.qpython.qpy3/files/bin/qpython-android5.sh && exit
iles/bin/qpython-android5.sh && exit <
Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding
Aborted
134|heroqltespr:/ $

This is what I see when I open the editor. I am a noob and dont know what to do.

Can't execute python code and return a result with startActivityForResult (always null)

I'm pulling my hair out trying to communicate from my Android app with QPython to execute some python code and return the result.

I'm trying it with 2.0.0-BETA-2 APK.

Here is documented:

http://www.qpython.org/en/guide_extend.html

And here there is a full project example:

https://github.com/qpython-android/app-call-qpython-api/blob/master/app/src/main/java/org/qpython/sample/MainActivity.java

But my problem is that it doesn't work, it doesn't return any data. On that repository there are issues of other people facing this issue.

Is there a working example doing this? I don't know also what parameters are available. I have been able to discover this two examples:

mBundle.putString("app", "myappid");
mBundle.putString("act", "onPyApi");
mBundle.putString("flag", "onQPyExec");
mBundle.putString("param", "");
mBundle.putString("pycode", "");

mBundle.putString("app", "myappid");
mBundle.putString("act", "onPyApi");
mBundle.putString("flag", "SL4A");
mBundle.putString("param", "fileapi");
mBundle.putString("pyfile", path);

wechat page link must point one issue

因为没拿到原创…所以微信文章没留言服务…

那就应该指向一个可以回复意见的空间吧!

要不是自己的 bloh/wiki 页面…含 DISCUS 服务…
但 D服务和谐中…

对每次版本发布建立对应反馈收集 Issue 再分解为对应 bugfix issue 也就自然了~不是?!

Tkinter can't be imported

I tried importing tkinter, but python raised "ImportError."

>>> import tkinter
Traceback (most recent call last):
File "", line 1, in
File "/data/user/0/org.qpython.qpy3/files/lib/python3.2/python32.zip/tkinter/init.py", line 39, in
ImportError: No module named _tkinter

Can I fix this import?

Cannot install pip requests

I always cannot install the pip install requests, always receive error cannot fetch index base url. I already tried to download and put it manually under lib but still canot run py script. Please advise, I not using external memory so the Qpython is in my phone memory. Im using android 5.0
screenshot_2017-08-25-16-12-05

Wakelock

When will there be a wakelock and if there is, how to use it?

Wrong touch position in kivy apps

Qpy detects touches in all kivy apps in a wrong position. They always ≈ 0.5 cm lower than required.
This problem comes from old Qpython versions.

Device:
Sony Xperia Z3 Tablet Compact (SGP621) Android 6.0.1

Kivy touchtracer example + enabled pointer location in android developer options:
picsart_09-04-08 59 55

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.