I'm trying to translate this Java code
startActivity(new Intent(android.provider.Settings.ACTION_DATE_SETTINGS));
to Kivy, so I can open the Android date settings dialog. So far, I tried with
from jnius import autoclass
from jnius import cast
from jnius import autoclass
from jnius import cast
PythonActivity = autoclass('org.renpy.android.PythonActivity')
intent = autoclass("android.provider.Settings")
currentActivity = cast('android.app.Activity', PythonActivity.mActivity)
currentActivity.startActivity(intent.ACTION_DATE_SETTINGS)
but I'm getting
Traceback (most recent call last):
File "main.py", line 282, in read_queue
...
File "<string>", line 7, in <module>
File "jnius/jnius_export_class.pxi", line 900, in jnius.jnius.JavaMultipleMethod.__call__ (jnius/jnius.c:27749)
JavaException: No methods matching your arguments
I tried several alternatives with setAction and setData but none works so far
Related
I'm trying to build my application, after installing flask_login0.4.1 and configuring it
i come across this error
Traceback (most recent call last):
File "C:\Users\Catalyst\Desktop\Python\chatAp\application.py", line 2, in <module>
from wtform_fields import *
File "C:\Users\Catalyst\Desktop\Python\chatAp\wtform_fields.py", line 6, in <module>
from models import User
File "C:\Users\Catalyst\Desktop\Python\chatAp\models.py", line 2, in <module>
from flask_login import UserMixin
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask_login\__init__.py", line 16, in <module>
from .login_manager import LoginManager
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask_login\login_manager.py", line 24, in <module>
from .utils import (_get_user, login_url as make_login_url, _create_identifier,
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask_login\utils.py", line 13, in <module>
from werkzeug.security import safe_str_cmp
ImportError: cannot import name 'safe_str_cmp' from 'werkzeug.security' (C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\werkzeug\security.py)
based on answers on stackoverflow I have downgraded werkzeug to 2.0.0 but i got other error
Traceback (most recent call last):
File "C:\Users\Catalyst\Desktop\Python\chatAp\application.py", line 1, in <module>
from flask import Flask, render_template,redirect,url_for
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask\__init__.py", line 4, in <module>
from . import json as json
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask\json\__init__.py", line 8, in <module>
from ..globals import current_app
File "C:\Users\Catalyst\Desktop\Python\chatAp\venv\lib\site-packages\flask\globals.py", line 56, in <module>
app_ctx: "AppContext" = LocalProxy( # type: ignore[assignment]
TypeError: LocalProxy.__init__() got an unexpected keyword argument 'unbound_message'
what other alternatives solutions I can use
I'm using flask 2.2.2
Try
Werkzeug <= 2.1.2
flask == 2.1.2
Both of these have to be compatible. Let me know if you can work it out. the above version worked for me.
I am trying to import UserNotifications from the PushKit framework but i don't know how to call it because the only Include function i know of in pyobjus is AppKit. I have not seen of any way to call frameworks from the PushKit when i try to call it from the AppKit. it returns an error. Below is my code and the error. I would appreciate any help.
from pyobjus import autoclass
from pyobjus.dylib_manager import load_framework, INCLUDE
load_framework(INCLUDE.AppKit)
UserNotifications = autoclass('UserNotifications')
Traceback
Traceback (most recent call last):
File "/Users/temitayoadefemi/PycharmProjects/test7/mainfile.py", line 5, in <module>
UserNotifications = autoclass('UserNotifications')
File "pyobjus/pyobjus.pyx", line 726, in pyobjus.autoclass
File "pyobjus/pyobjus.pyx", line 85, in pyobjus.MetaObjcClass.__new__
File "pyobjus/pyobjus.pyx", line 116, in pyobjus.MetaObjcClass.resolve_class
pyobjus.ObjcException: Unable to find class b'UserNotifications'
AppKit doesn't have a class called UserNotifications. You could use UNNotificationSettings for normal Push Notification or PKPushRegistry for VoIP Push Notification.
References:
https://developer.apple.com/documentation/pushkit?language=objc
https://developer.apple.com/documentation/usernotifications?language=objc
I am trying to connect Pepper to Dialogflow. The Dialogflow SDK is stored in the project folder/lib. The python version used by Pepper is 2.7. I use python 2.7.9.
self.folderName = os.path.join(self.framemanager.getBehaviorPath(self.behaviorId), "..\lib")
if self.folderName not in sys.path:
sys.path.append(self.folderName)
self.log(self.folderName)
import apiai
ai = apiai.ApiAI(CLIENT_ACCESS_TOKEN)
When running the code, I got the errors:
[ERROR] behavior.box :_safeCallOfUserMethod:281 _Behavior__lastUploadedChoregrapheBehaviorbehavior_1338328200__root__test_1: Traceback (most recent call last):
File "C:\PROGRA~2\ALDEBA~1\CHOREG~1.1\lib\naoqi.py", line 271, in _safeCallOfUserMethod
func()
File "<string>", line 23, in onInput_onStart
File "C:\Users\AppData\Roaming\PackageManager\apps\.lastUploadedChoregrapheBehavior\behavior_1\..\lib\apiai\__init__.py", line 9, in <module>
from .requests.query import Entry
File "C:\Users\AppData\Roaming\PackageManager\apps\.lastUploadedChoregrapheBehavior\behavior_1\..\lib\apiai\requests\__init__.py", line 3, in <module>
from .request import Request
File "C:\Users\loadedChoregrapheBehavior\behavior_1\..\lib\apiai\requests\request.py", line 9, in <module>
from httplib import HTTPSConnection
ImportError: cannot import name HTTPSConnection
Any ideas how to solve it?
This program must be run on the robot, rather than on your computer.
System : XP, work with python 2.7
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
import json
File "C:\Python27\ArcGIS10.1\lib\json\__init__.py", line 108, in <module>
from .decoder import JSONDecoder
File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 7, in <module>
from json import scanner
ImportError: cannot import name scanner
Anyone can explain me how to manage this error please ???
this morning I haven't got this problem, but this afternoon my script won't work ((
I think this is caused by relative import path,
File "C:\Python27\ArcGIS10.1\lib\json\decoder.py", line 7,
from json import scanner
it's trying to import scanner from
C:\Python27\ArcGIS10.1\lib\json
If I import pgdb just in command line, it works fine.
It was also working fine in Eclipse until recently (with exactly the same Python 2.7.2), but now, when I import pgdb, even in a very simple file (containing just import pgdb), I have this error message:
Traceback (most recent call last):
File ".../src/pgdbtest.py", line 8, in <module>
import pgdb
File "build/bdist.macosx-10.6-x86_64/egg/pgdb.py", line 66, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/_pg.py", line 7, in <module>
File "build/bdist.macosx-10.6-x86_64/egg/_pg.py", line 4, in __bootstrap__
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources.py", line 908, in resource_filename
self, resource_name
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources.py", line 1383, in get_resource_filename
self._extract_resource(manager, self._eager_to_zip(name))
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pkg_resources.py", line 1401, in _extract_resource
timestamp = time.mktime(date_time)
AttributeError: 'module' object has no attribute 'mktime'
In fact, more generally, I discovered that if I try from time import mktime, I also have error:
from time import mktime
ImportError: cannot import name mktime
OK, stupid mistake: I created a package named "time"...
So I just deleted it and everything is alright now.