- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在开发一个需要使用 boto3
将文件上传到 S3 的 Kivy 应用程序但在 JSON decoder.py
中失败尝试加载 endpoint
时模型并建立一个client
联系。在 16.04
上本地运行效果很好但在使用 buildozer
编译后失败并在 Lollipop 5.1.1
上运行.
Buildozer 日志。
I/python (27222): [INFO ] [Base ] Leaving application in progress...
I/python (27222): Traceback (most recent call last):
I/python (27222): File "/build/phytogp/android/app/main.py", line 10, in <module>
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/app.py", line 828, in run
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/base.py", line 504, in runTouchApp
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/core/window/window_sdl2.py", line 663, in mainloop
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/core/window/window_sdl2.py", line 405, in _mainloop
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/base.py", line 342, in idle
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/base.py", line 327, in dispatch_input
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/base.py", line 293, in post_dispatch_input
I/python (27222): File "kivy/_event.pyx", line 718, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:8191)
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivymd/ripplebehavior.py", line 68, in on_touch_up
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivymd/button.py", line 314, in on_touch_up
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivymd/button.py", line 206, in on_touch_up
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/uix/behaviors/button.py", line 179, in on_touch_up
I/python (27222): File "kivy/_event.pyx", line 714, in kivy._event.EventDispatcher.dispatch (kivy/_event.c:8146)
I/python (27222): File "kivy/_event.pyx", line 1225, in kivy._event.EventObservers.dispatch (kivy/_event.c:14035)
I/python (27222): File "kivy/_event.pyx", line 1109, in kivy._event.EventObservers._dispatch (kivy/_event.c:12816)
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/kivy/lang/builder.py", line 64, in custom_callback
I/python (27222): File "<string>", line 31, in <module>
I/python (27222): File "/build/phytogp/android/app/views/widgets/checkedin.py", line 112, in finish_button_on_release
I/python (27222): File "/build/phytogp/android/app/views/widgets/checkedin.py", line 144, in upload_report
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/boto3/__init__.py", line 83, in client
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/boto3/session.py", line 263, in client
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/botocore/session.py", line 826, in create_client
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/botocore/session.py", line 701, in get_component
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/botocore/session.py", line 897, in get_component
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/botocore/session.py", line 186, in create_default_resolver
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/botocore/loaders.py", line 132, in _wrapper
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/botocore/loaders.py", line 420, in load_data
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/site-packages/botocore/loaders.py", line 175, in load_file
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/json/__init__.py", line 339, in loads
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/json/decoder.py", line 366, in decode
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/json/decoder.py", line 382, in raw_decode
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/json/scanner.py", line 38, in _scan_once
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/json/decoder.py", line 195, in JSONObject
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/json/scanner.py", line 40, in _scan_once
I/python (27222): File "/build/phytogp/android/platform/build/dists/phytogp/private/lib/python2.7/json/decoder.py", line 262, in JSONArray
I/python (27222): ValueError: Expecting , delimiter: line 63 column 29 (char 1666)
导致问题的连接命令是:
主.py
client = boto3.client(
's3',
aws_access_key_id='IVEGOTTHEKEY',
aws_secret_access_key='IVEGOTTHESECRET',
region_name='ap-southeast-2',
)
查看堆栈跟踪,它正在尝试加载 endpoints.json
与 botocore.loader
在 load_file
load_data
中的行方法:
loaders.py
@instance_cache
def load_data(self, name):
for possible_path in self._potential_locations(name):
found = self.file_loader.load_file(possible_path)
if found is not None:
return found
# We didn't find anything that matched on any path.
raise DataNotFoundError(data_path=name)
它在这里寻找endpoints.json
在_potential_locations
它们是:
loaders.py
# The included models in botocore/data/ that we ship with botocore.
BUILTIN_DATA_PATH = os.path.join(BOTOCORE_ROOT, 'data')
# For convenience we automatically add ~/.aws/models to the data path.
CUSTOMER_DATA_PATH = os.path.join(os.path.expanduser('~'),
'.aws', 'models')
BOTOCORE_ROOT
是它应该获取这些文件的地方。部署到 Android 时 BOTOCORE_ROOT
是/data/data/com.phyto.phytogp/files/app/lib/python2.7/site-packages/botocore
.
endpoints.json
存在于这条路径上。转接endpoints.json
从平板电脑到 PC 并调用 load_file
JSONFileLoader
的方法工作正常并返回 OrderedDict
没有解码失败。
堆栈跟踪没有显示它未能通过引发 DataNotFoundError
找到文件这表明它找到了文件但无法解析它因此 json/decoder
错误。
我试过强制使用 boto3
的版本和依赖于相同的本地使用但不好。 APK 建立在 Buildozer_VM 上具有以下规范:
Buildozer.spec
[app]
# (str) Title of your application
title = PhytoGP
# (str) Package name
package.name = phytogp
# (str) Package domain (needed for android/ios packaging)
package.domain = com.phyto
# (str) Source code where the main.py live
source.dir = .
# (list) Source files to include (let empty to include all the files)
source.include_exts = py,png,jpg,kv,atlas,ttf,db
# (list) List of inclusions using pattern matching
#source.include_patterns = assets/*,images/*.png
# (list) Source files to exclude (let empty to not exclude anything)
#source.exclude_exts = spec
# (list) List of directory to exclude (let empty to not exclude anything)
source.exclude_dirs = tests, bin
# (list) List of exclusions using pattern matching
#source.exclude_patterns = license,images/*/*.jpg
# (str) Application versioning (method 1)
version = 0.1
# (str) Application versioning (method 2)
# version.regex = __version__ = ['"](.*)['"]
# version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = kivy,sqlite3,boto3==1.4.1,botocore==1.5.78,python-dateutil==2.6.0,jmespath==0.9.3,openssl,sparkpost,urllib3,requests,xhtml2pdf,reportlab,html5lib==1.0b8,webencodings,git+https://gitlab.com/kivymd/KivyMD.git
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (list) Garden requirements
#garden_requirements =
# (str) Presplash of the application
presplash.filename = %(source.dir)s/assets/presplash.png
# (str) Icon of the application
icon.filename = %(source.dir)s/assets/icon.png
# (str) Supported orientation (one of landscape, portrait or all)
orientation = landscape
# (list) List of service to declare
#services = NAME:ENTRYPOINT_TO_PY,NAME2:ENTRYPOINT2_TO_PY
#
# OSX Specific
#
#
# author = © Copyright Info
#
# Android specific
#
# (bool) Indicate if the application should be fullscreen or not
fullscreen = 1
# (list) Permissions
android.permissions = INTERNET
# (int) Android API to use
#android.api = 19
# (int) Minimum API required
#android.minapi = 9
# (int) Android SDK version to use
#android.sdk = 20
# (str) Android NDK version to use
#android.ndk = 9c
# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
#android.ndk_path =
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
#android.sdk_path =
# (str) ANT directory (if empty, it will be automatically downloaded.)
#android.ant_path =
# (str) python-for-android git clone directory (if empty, it will be automatically cloned from github)
#android.p4a_dir =
# (str) The directory in which python-for-android should look for your own build recipes (if any)
#p4a.local_recipes =
# (str) Filename to the hook for p4a
#p4a.hook =
# (list) python-for-android whitelist
#android.p4a_whitelist =
# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
# when an update is due and you just want to test/build your package
# android.skip_update = False
# (str) Bootstrap to use for android builds (android_new only)
# android.bootstrap = sdl2
# (str) Android entry point, default is ok for Kivy-based app
#android.entrypoint = org.renpy.android.PythonActivity
# (list) List of Java .jar files to add to the libs so that pyjnius can access
# their classes. Don't add jars that you do not need, since extra jars can slow
# down the build process. Allows wildcards matching, for example:
# OUYA-ODK/libs/*.jar
#android.add_jars = foo.jar,bar.jar,path/to/more/*.jar
# (list) List of Java files to add to the android project (can be java or a
# directory containing the files)
#android.add_src =
# (str) python-for-android branch to use, if not master, useful to try
# not yet merged features.
#android.branch = master
# (str) OUYA Console category. Should be one of GAME or APP
# If you leave this blank, OUYA support will not be enabled
#android.ouya.category = GAME
# (str) Filename of OUYA Console icon. It must be a 732x412 png image.
#android.ouya.icon.filename = %(source.dir)s/data/ouya_icon.png
# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =
# (list) Android additionnal libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
#android.add_libs_mips = libs/android-mips/*.so
# (bool) Indicate whether the screen should stay on
# Don't forget to add the WAKE_LOCK permission if you set this to True
#android.wakelock = False
# (list) Android application meta-data to set (key=value format)
#android.meta_data =
# (list) Android library project to add (will be added in the
# project.properties automatically.)
#android.library_references =
# (str) Android logcat filters to use
#android.logcat_filters = *:S python:D
# (bool) Copy library instead of making a libpymodules.so
#android.copy_libs = 1
# (str) The Android arch to build for, choices: armeabi-v7a, arm64-v8a, x86
android.arch = armeabi-v7a
#
# iOS specific
#
# (str) Path to a custom kivy-ios folder
#ios.kivy_ios_dir = ../kivy-ios
# (str) Name of the certificate to use for signing the debug version
# Get a list of available identities: buildozer ios list_identities
#ios.codesign.debug = "iPhone Developer: <lastname> <firstname> (<hexstring>)"
# (str) Name of the certificate to use for signing the release version
#ios.codesign.release = %(ios.codesign.debug)s
[buildozer]
# (int) Log level (0 = error only, 1 = info, 2 = debug (with command output))
log_level = 2
# (int) Display warning if buildozer is run as root (0 = False, 1 = True)
warn_on_root = 1
# (str) Path to build artifact storage, absolute or relative to spec file
build_dir = /build/phytogp
# (str) Path to build output (i.e. .apk, .ipa) storage
# bin_dir = ./bin
# -----------------------------------------------------------------------------
# List as sections
#
# You can define all the "list" as [section:key].
# Each line will be considered as a option to the list.
# Let's take [app] / source.exclude_patterns.
# Instead of doing:
#
#[app]
#source.exclude_patterns = license,data/audio/*.wav,data/images/original/*
#
# This can be translated into:
#
#[app:source.exclude_patterns]
#license
#data/audio/*.wav
#data/images/original/*
#
# -----------------------------------------------------------------------------
# Profiles
#
# You can extend section / key with a profile
# For example, you want to deploy a demo version of your application without
# HD content. You could first change the title to add "(demo)" in the name
# and extend the excluded directories to remove the HD content.
#
#[app@demo]
#title = My Application (demo)
#
#[app:source.exclude_patterns@demo]
#images/hd/*
#
# Then, invoke the command line with the "demo" profile:
#
#buildozer --profile demo android debug
SSL 通信在部署和与 SparkPost
通信时工作正常和另一个第 3 方 API。
我没有想法,所以任何帮助都会很棒。谢谢
最佳答案
经过数天的工作,未发现异常 JSON 解析问题的解决方案。最后,回滚到 boto (v2),它没有实现确定端点等的 JSON 模型。部署时工作正常。
关于android - Kivy 应用程序中的 Boto3 客户端 session 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46825756/
我正在准备在 kivy 中做一个进度条,我可以用它构建应用程序,但是当我运行一个函数(循环)时它不能被更新,我该怎么做? 这是我的代码: 导入库: from kivy.app import App f
为猕猴桃中的按钮创建圆角的首选方法是什么? 还有其他同样可行的方法来执行此任务吗?谢谢。 最佳答案 这是一个棘手的问题。就我而言,Widgets始终是矩形。但是我们可以更改背景,并分别使用backgr
我是kivy的新手。我有一个按钮可以刷新数据库中的列表项,这是绑定(bind)到该按钮的函数: def refresh_account(self): self.ids.grid.clear_w
我正在尝试使用 NumericProperty,但在尝试将其用作值时出现类型错误 我的代码是这样的 from kivy.properties import NumericProperty from k
在按钮中组合图像/图标和文本的首选方法是什么?例如,您将如何使用 text = 'my button' 创建按钮,以及该文本左侧的图形图标? 最佳答案 关于问题#2。 Kivy 的工作方式是嵌入 Wi
在 kivy 中,您如何使用自动居中的多行文本创建按钮或标签?如果你做类似的事情,Button(text = 'my button\nthis is my button') ,似乎只有一条线会居中,而
我知道如何制作彩色背景,但我似乎找不到任何有用的内容将图像设置为背景,并且非常感谢您对我的代码的任何帮助。 这是我的 .py 文件: from kivy.app import App from kiv
我的 Kivy 语言文件有许多 font_size 属性,所有属性都具有相同的值,是否可以在 KV lang 中分配变量? 当前 KV 文件示例: #User ID Label:
我有一个使用许多标签的 kivy 应用程序。是否可以从列表中获取它们的值?例如(但这不起作用) Label: text:root.label_value[0]
任何人都可以帮助我使用任何 sdk 在 kivy 应用程序中实现广告。 Revmobs 已停止支持 Kivy。 任何其他实现广告的方法也可以使用。 谢谢 最佳答案 我在 上取得了成功AdBuddiz
基维 gesture documentation有点缺乏,仅指手势示例。 我想知道为什么 Kivy 不提供任何辅助方法,例如 on_swipe_left、on_swipe_up 等。最好将 minsc
我目前使用的是 python 2.7.9。我试过重新安装 cython 并更新所有依赖项,但它没有用。我不知道 Buildozer 或 Cython 有什么问题。该应用程序直接从终端正常运行。 #er
Kivy 文档指定 "each widget in Kivy already have by default their Canvas" .然而,在实践中,小部件似乎持有对整个窗口的共享 Canvas
我是 Python 库 kivy 的新手。我找到了额外的库 kivy-md,它有非常漂亮的 ui 元素。目前我想从字典变量创建许多 MDTextField 小部件,例如 # text_fields.p
python 3.4基维 1.10.0 我正在尝试使用 Kivy Animation 类来为我的 Image 类制作动画。这是因为我想分别修改每个图像的 anim_delay 和位置值。 我想修改图像
我正在尝试使用 kivy 启动器在我的 android 上启动我的应用程序,这样我就可以在较小的屏幕上看到小部件位置/大小发生了什么。 当我启动时,它崩溃了。 所以...我猜我在我的应用程序中做了一些
有谁知道如何在 Kivy 中增加 MeshLinePlot 的线宽? 谢谢 更新 我从@Ikolim 那里得到了关于修改 kivy.graph 中的 LinePLot 函数的答案 class Line
如何使用 Kivy 更改窗口的大小。我一直在四处寻找,除了进入窗口的大小之外,我几乎可以更改所有内容。 从示例图片文件: 主文件 #!/usr/bin/kivy ''' Pictures demo =
我试图在 Windows 上安装 kivy 设计器。我按照步骤操作,但是当我尝试运行时 python -m designer 我收到以下错误: [INFO ] [Kivy ] v1.
我正在尝试让我的 python 和 kivy 文件打开一个弹出窗口。它说我的 Boxlayout 对象没有属性“open_popup” 这是我的Python代码: from kivy.app impo
我是一名优秀的程序员,十分优秀!