3

所以我正在尝试将 SpeechRecognition 包与我的 Kivy 应用程序一起使用。我正在使用 buildozer 进行构建和部署,但我需要为 SpeechRecognition 包创建自定义配方。

到目前为止,我已经下载了包含所有食谱的 p4a 文件夹并创建了一个新文件夹“speech_recognition”。构建应用程序时,buildozer 尝试下载包,但随后失败。我想我需要关于如何准确设置我的食谱文件的帮助。

我查看了一些可用的示例食谱here

这是我的 Speech_recognition/__init__.py

from pythonforandroid.recipe import CppCompiledComponentsPythonRecipe
class SRRecipe(CppCompiledComponentsPythonRecipe):
    version = '3.8.1'
    url = 'https://github.com/Uberi/speech_recognition/archive/{version}.zip'
    site_packages_name = 'speech_recognition'
    #depends = ['setuptools']
recipe = SRRecipe()

这是控制台输出:

[INFO]:    -> running mkdir -p /home/lukas/Documents...(and 86 more)
[INFO]:    -> directory context /home/lukas/Documents/SpeechRecog/.buildozer/android/platform/build-armeabi-v7a/packages/speech_recognition
[INFO]:    -> running basename https://github.com/Ube...(and 31 more)
[INFO]:    -> running rm speech_recognition-3.8.1.zip
[INFO]:    -> running rm -f .mark-speech_recognition-3.8.1.zip
[INFO]:    Downloading speech_recognition from https://github.com/Uberi/speech_recognition-3.8.1.zip
Traceback (most recent call last):
  File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/toolchain.py", line 1196, in <module>
    main()
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/entrypoints.py", line 18, in main
    ToolchainCL()
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/toolchain.py", line 671, in __init__
    getattr(self, args.subparser_name.replace('-', '_'))(args)
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/toolchain.py", line 155, in wrapper_func
    build_dist_from_args(ctx, dist, args)
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/toolchain.py", line 209, in build_dist_from_args
    args, "ignore_setup_py", False
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/build.py", line 558, in build_recipes
    recipe.download_if_necessary()
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/recipe.py", line 356, in download_if_necessary
    self.download()
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/recipe.py", line 402, in download
    self.download_file(self.versioned_url, filename)
  File "/home/lukas/Documents/SpeechRecog/python-for-android/pythonforandroid/recipe.py", line 217, in download_file
    urlretrieve(url, target, report_hook)
  File "/usr/lib/python3.6/urllib/request.py", line 1819, in retrieve
    block = fp.read(bs)
  File "/home/lukas/kivy_venv/lib/python3.6/tempfile.py", line 624, in func_wrapper
    return func(*args, **kwargs)
ValueError: read of closed file

令我感到奇怪的是,输出中的 url 与我指定的 url 不同?任何帮助,将不胜感激。

4

0 回答 0