ValueError: read of closed file

127 views
Skip to first unread message

Mark Leong

unread,
Dec 30, 2020, 8:29:31 PM12/30/20
to Kivy users support
I have previously successfully built the apk using MX Linux 19.x (python 3.8) and using the apk.

However due to some hardware issue (using a dated computer), I have switch the os to Debian 10 (xfce) - it is must faster and more pleasant to use.  I am now setting up my programming environment again.

The system uses python 3.7.3 and I manage to set up kivy.  The programme runs without issue on the computer and packaged using PyInstaller too. 

However when I tried to build the apk, the got the following error (last few lines):

    urlretrieve(url, filename, report_hook)
  File "/usr/lib/python3.7/urllib/request.py", line 1824, in retrieve
    block = fp.read(bs)
  File "/usr/lib/python3.7/tempfile.py", line 620, in func_wrapper
    return func(*args, **kwargs)
ValueError: read of closed file


I have included the following in the buildozer.spec:-

android.minapi = 24
android.sdk = 24
android.ndk = 19b
android.ndk_api = 24

I am using kivy version 2.0.0

Appreciate help in resolving the issue.





planckp...@gmail.com

unread,
Dec 30, 2020, 9:18:25 PM12/30/20
to Kivy users support
Looks like it is not finding the NDK.
Did you type 'y' to the Google license agreements?

To redo that step, delete ~/.buildozer

Pranav Balaji Pooruli

unread,
Dec 30, 2020, 9:24:25 PM12/30/20
to kivy-...@googlegroups.com
Can you please paste in the whole traceback instead of the last few lines?

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/13fb2e26-4a40-4719-8a13-56d92e54a9bco%40googlegroups.com.

markl...@gmail.com

unread,
Dec 30, 2020, 10:31:11 PM12/30/20
to Kivy users support
Here is the complete log:

# Check configuration tokens
# WARNING: Config token app android.sdk is deprecated and ignored, but you set value 24
# Ensure build layout
# Check configuration tokens
# Read available permissions from api-versions.xml
# Preparing build
# Check requirements for android
# Run 'dpkg --version'
# Cwd None
Debian 'dpkg' package management program version 1.19.7 (i386).
This is free software; see the GNU General Public License version 2 or
later for copying conditions. There is NO warranty.
# Search for Git (git)
#  -> found at /usr/bin/git
# Search for Cython (cython)
#  -> found at /home/mark/Documents/python3/kivy/password-manager/bin/cython
# Search for Java compiler (javac)
#  -> found at /usr/lib/jvm/java-11-openjdk-i386/bin/javac
# Search for Java keytool (keytool)
#  -> found at /usr/lib/jvm/java-11-openjdk-i386/bin/keytool
# Install platform
# Run 'git config --get remote.origin.url'
# Cwd /home/mark/Documents/python3/kivy/password-manager/kivyapp/.buildozer/android/platform/python-for-android
# Run 'git branch -vv'
# Cwd /home/mark/Documents/python3/kivy/password-manager/kivyapp/.buildozer/android/platform/python-for-android
* master 5a94d074 [origin/master] Merge pull request #2244 from Chronolife-team/native_services_upstream
# Run '/home/mark/Documents/python3/kivy/password-manager/bin/python3 -m pip install -q  \'appdirs\' \'colorama>=0.3.3\' \'jinja2\' \'six\' \'enum34; python_version<"3.4"\' \'sh>=1.10; sys_platform!="nt"\' \'pep517<0.7.0"\' \'toml\''
# Cwd None
# Apache ANT found at /home/mark/.buildozer/android/platform/apache-ant-1.9.4
# Android SDK found at /home/mark/.buildozer/android/platform/android-sdk
# Recommended android's NDK version by p4a is: 19c
# Android NDK is missing, downloading
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/__main__.py", line 4, in <module>
    main()
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/__init__.py", line 1047, in run_command
    self.target.run_commands(args)
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/target.py", line 92, in run_commands
    func(args)
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/target.py", line 108, in cmd_release
    self.buildozer.prepare_for_build()
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/__init__.py", line 169, in prepare_for_build
    self.target.install_platform()
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/targets/android.py", line 665, in install_platform
    self._install_android_ndk()
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/targets/android.py", line 457, in _install_android_ndk
    cwd=self.buildozer.global_platform_dir)
  File "/home/mark/Documents/python3/kivy/password-manager/lib/python3.7/site-packages/buildozer/__init__.py", line 677, in download
    urlretrieve(url, filename, report_hook)
  File "/usr/lib/python3.7/urllib/request.py", line 1824, in retrieve
    block = fp.read(bs)
  File "/usr/lib/python3.7/tempfile.py", line 620, in func_wrapper
    return func(*args, **kwargs)
ValueError: read of closed file


markl...@gmail.com

unread,
Dec 30, 2020, 10:32:24 PM12/30/20
to Kivy users support
    urlretrieve(url, filename, report_hook)
  File "/usr/lib/python3.7/urllib/request.py", line 1824, in retrieve
    block = fp.read(bs)
  File "/usr/lib/python3.7/tempfile.py", line 620, in func_wrapper
    return func(*args, **kwargs)
ValueError: read of closed file
On Thursday, 31 December 2020 at 10:24:25 UTC+8 pranav....@gmail.com wrote:
Reply all
Reply to author
Forward
0 new messages