I have a kivy app, which runs on my linux desktop.
I can also build it with buildozer and run the app on my android phone.
I include a sync with google-drive through the pydrive modul -> works on linux.
I added PyDrive to the requirements in my buildozer.spec file but when i run my app on android ,I get the following error on my phone via adb:
I/python (16976): File "/home/taper/Dokumente/py-spielwiese/myapp/.buildozer/android/app/main.py", line 23, in <module>
I/python (16976): File "/home/taper/Dokumente/py-spielwiese/myapp/.buildozer/android/app/drivesync.py", line 1, in <module>
I/python (16976): File "/home/taper/Dokumente/py-spielwiese/myapp/.buildozer/android/app/_applibs/pydrive/drive.py", line 2, in <module>
I/python (16976): File "/home/taper/Dokumente/py-spielwiese/myapp/.buildozer/android/app/_applibs/pydrive/files.py", line 4, in <module>
I/python (16976): File "/home/taper/Dokumente/py-spielwiese/myapp/.buildozer/android/app/_applibs/apiclient/__init__.py", line 17, in <module>
I/python (16976): File "/home/taper/Dokumente/py-spielwiese/myapp/.buildozer/android/app/_applibs/googleapiclient/discovery.py", line 50, in <module>
I/python (16976): File "/home/taper/Dokumente/py-spielwiese/myapp/.buildozer/android/app/_applibs/httplib2/__init__.py", line 95, in <module>
I/python (16976): ImportError: No module named iri2uri
Some modules are blacklisted. You can check in .buildozer/android/platform/python-for-android/src/blacklist.txt if iri2uri is.
Also you can try to add iri2uri to you buildozer.spec requirements
I have a very similar problem. I'm trying to send an email using the GMail API with OAuth2 authentication. It works on my PC, but it crashes immediately on my smartphone.
I tried to include iri2uri in the buildozer.spec, but buildozer couldn't create the APK.
I'm not sure if it helps, but in this thread someone suggest to use an Android flow instead of a web flow.
https://groups.google.com/forum/#!starred/kivy-users/3K9y1X0QcHM
Related
I am attempting to use the Google Cloud Datastore, but importing google.cloud.datastore gives an ImportError:
ERROR 2018-03-13 19:28:29,013 wsgi.py:263]
Traceback (most recent call last):
File "/home/<user>/Software/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/<user>/Software/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 299, in _LoadHandler
handler, path, err = LoadObject(self._handler)
File "/home/<user>/Software/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 85, in LoadObject
obj = __import__(path[0])
File "/home/<user>/Projects/<my_project>/main.py", line 1, in <module>
from my_project import app
File "/home/<user>/Projects/<my_project>/<my_project>/__init__.py", line 2, in <module>
from my_project.submit.controllers import submit
File "/home/<user>/Projects/<my_project>/<my_project>/submit/controllers.py", line 6, in <module>
from . import model_datastore
File "/home/<user>/Projects/<my_project>/<my_project>/submit/model_datastore.py", line 2, in <module>
from google.cloud import datastore
File "/home/<user>/Projects/<my_project>/env/local/lib/python2.7/site-packages/google/cloud/datastore/__init__.py", line 57, in <module>
from pkg_resources import get_distribution
ImportError: No module named pkg_resources
I am on Linux Mint attempting to run a Google App Engine local dev server.
I am using a virtual environment. Both setuptools and pkg_resources are installed and updated in the virtual environment. When I enter the python cmd line interpreter from the virtual env and import pkg_resources, it works fine. When I run the google app engine dev server by doing dev_appserver app.yaml, everything works fine until I access the page that activates the handler that imports datastore, then I get this error.
None of the other similar posts about 'pkg_resources` import error were helpful.
If there is any other info I can provide that would help, please let me know. Thanks!
In the standard environment you need to install all your dependencies inside your application. See Using third-party libraries.
Whatever you have installed in the local environment (virtual or not) doesn't matter, GAE doesn't know how to use those and your app might not work properly locally and definitely won't work when deployed on GAE.
You traceback indicates that you're loading the datastore library from your virtual env, not from your app, which is most likely why it doesn't work:
.../env/local/lib/python2.7/site-packages/google/cloud/datastore/__init__.py
You need to fix your app dependency installation.
This discussion might be of interest as well: No module named warnings when starting GAE inside virtualenv locally
I'm trying to get a Python Google App Engine to run locally (macOS Sierra) and am having all sorts of trouble with and was wondering what I could possibly be missing. Please note this is my first foray into Python (usually develop with Ruby).
I've downloaded Google App Engine sdk for python and followed the steps to get it up and running. After a few attempts I've placed it within the same directory as my App.
I'm using Python 2.7.x which is what the App requires.
I'm using virtualenv so I've initiated it like so: source bin/activate and try to run the app like so: dev_appserver.py --storage_path=../GAE-storage/ --port=9080 --log_level=info $* .
When I try ti visit the page I get an error like:
Traceback (most recent call last):
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 354, in __getattr__
self._update_configs()
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 290, in _update_configs
self._registry.initialize()
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 165, in initialize
import_func(self._modname)
File "/Library/WebServer/Documents/python/flow.city/appengine_config.py", line 19, in <module>
from django.conf import settings
ImportError: No module named django.conf
INFO 2016-11-20 11:09:47,599 module.py:788] default: "GET / HTTP/1.1" 500 -
So, to fix this issue I've downloaded Django manually and extracted it to app directory. Then it complained I don't features, so I've also downloaded it manually and added to the project directory. Now is complaining about something else:
ERROR 2016-11-20 11:29:18,635 wsgi.py:263]
Traceback (most recent call last):
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/runtime/wsgi.py", line 240, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 354, in __getattr__
self._update_configs()
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 290, in _update_configs
self._registry.initialize()
File "/Users/wm/lib/google-cloud-sdk/platform/google_appengine/google/appengine/api/lib_config.py", line 165, in initialize
import_func(self._modname)
File "/Library/WebServer/Documents/python/flow.city/appengine_config.py", line 22, in <module>
import features
File "/Library/WebServer/Documents/python/flow.city/flowcity/features.py", line 23, in <module>
from base.basics import get_config
File "/Library/WebServer/Documents/python/flow.city/flowcity/base/basics.py", line 13, in <module>
from dbutils import date_to_str, rescale, get_app_url
File "/Library/WebServer/Documents/python/flow.city/flowcity/dbutils.py", line 23, in <module>
from i18n import _
File "/Library/WebServer/Documents/python/flow.city/flowcity/i18n.py", line 12, in <module>
from django.utils.translation import *
TypeError: Item in ``from list'' not a string
INFO 2016-11-20 11:29:18,641 module.py:788] default: "GET / HTTP/1.1" 500 -
So it makes me wonder if the approach I've taken is the right approach to get the App running locally? When cloning a new project in Ruby, I'd do a bundle install so it'd download all requirements for that project. Is there something similar in Python that I should do?
Please note that I've also tried without virtualenv and results were the same.
I am using Oracle VirtualBox running Ubuntu 16. I have been able to build apk files for a while until my latest build. My program will run and keep its functionality when run with python 2.7 on the same Virtual machine. When i install the .apk file on my Samsung S3 it shows the standard kivy loading screen then crashes after around 20 seconds. PLEASE HELP
I ran the latest build with verabose below is the log file.
https://drive.google.com/open?id=0B1XW1ekAndYiT2NrUTRNeHZhVGc
EDIT
After researching adb logcat i have been able to find this error. It occurs when "adb logcat" is run on a usb connected device.
I/python (29113): Traceback (most recent call last):
I/python (29113): File "/home/paul/Desktop/10/.buildozer/android/app/main.py", line 11, in <module>
I/python (29113): File "/home/paul/Desktop/10/.buildozer/android/app/_applibs/bs4/__init__.py", line 35, in <module>
I/python (29113): File "/home/paul/Desktop/10/.buildozer/android/app/_applibs/bs4/builder/__init__.py", line 315, in <module>
I/python (29113): ImportError: cannot import name _htmlparser
I/python (29113): Python for android ended.
EDIT
Line 11 in main.py is
from bs4 import BeautifulSoup as bs
I there something obvious im missing?
Turn USB Debuggin mode on in your device and connect your device to your PC and then run adb logcat. Run the application on your device and see what is going on in your application and what is the reason of crashing. you could also show us the the adb logcat result if you couldn't figure out the reason.
I want the line
import dropbox
to work. I downloaded the Python Core API from Dropbox, and copied the contents of the zip file into my (otherwise working) app's folder. When I run my app, it gives me the following error:
ERROR 2013-08-07 19:47:04,111 wsgi.py:219]
Traceback (most recent call last):
File "/home/myusername/Downloads/google_appengine/google/appengine/runtime/wsgi.py", line 196, in Handle
handler = _config_handle.add_wsgi_middleware(self._LoadHandler())
File "/home/myusername/Downloads/google_appengine/google/appengine/runtime/wsgi.py", line 255, in _LoadHandler
handler = __import__(path[0])
File "/home/myusername/Downloads/appname/appname.py", line 1, in <module>
import dropbox
File "/home/myusername/Downloads/appname/dropbox/__init__.py", line 3, in <module>
from . import client, rest, session
File "/home/myusername/Downloads/appname/dropbox/client.py", line 14, in <module>
from .rest import ErrorResponse, RESTClient
File "/home/myusername/Downloads/appname/dropbox/rest.py", line 7, in <module>
import pkg_resources
ImportError: No module named pkg_resources
How do I resolve this error?
As indicated by the link posted by #Tim Dierks, you can solve this issue by creating a pkg_resouces module within the dropbox folder with the contents
def resource_filename(*args):
cert_path = '/path/to/trusted-certs.crt'
return cert_path
As far as I can tell, pkg_resources only needs one method that returns the path to a certificate. trusted-certs.crt should be in your dropbox source folder.
You need to also package and distribute the pkg_resources module into your App Engine app. However, from what I've seen elsewhere, you'll run into some other challenges thereafter. It looks like the answers to Writing files to Dropbox account from GAE have gotten this working (for put, anyway).
I'm using python 2.6, sqlalchemy 0.6 for a tiny desktop application. Also i'm using py2exe and sqlalchemy-migrate and i'm trying to integrate migrate inside the exe. In this way when the user starts the application the database gets automatically upgraded.
If i try to use migrate in my eclipse project it works well but i want to release the project itself in an exe using py2exe. Unfortunately when i start the exe i got the error:
Traceback (most recent call last):
File "sagra.py", line 7, in <module>
File "guiutil.pyc", line 3, in <module>
File "bo.pyc", line 4, in <module>
File "database.pyc", line 26, in <module>
File "<string>", line 2, in version_control
File "migrate\versioning\util\__init__.pyc", line 160, in with_engine
File "migrate\versioning\api.pyc", line 248, in version_control
File "migrate\versioning\schema.pyc", line 128, in create
File "migrate\versioning\repository.pyc", line 76, in __init__
File "migrate\versioning\repository.pyc", line 97, in verify
migrate.versioning.exceptions.InvalidRepositoryError: db_repository
but the directory db_repository and the migration scripts are correctly inside the "library.zip" used by py2exe to incorporate all the python resources used by my software.
It seems sqlalchemy-migrate doesn't search inside the zip for the directory of the repository.
Here the problem (repository.py):
def verify(cls, path):
"""
Ensure the target path is a valid repository.
:raises: :exc:`InvalidRepositoryError <migrate.versioning.exceptions.InvalidRepositoryError>`
"""
# Ensure the existence of required files
try:
cls.require_found(path)
cls.require_found(os.path.join(path, cls._config))
cls.require_found(os.path.join(path, cls._versions))
except exceptions.PathNotFoundError, e:
raise exceptions.InvalidRepositoryError(path)
How to read the repository from a zip ?
Is there anyone who have tried (and succeded) to use sqlalchemy-migrate inside the exe generated by py2exe ?
Thanks for any help