Buildozer: OSError: [Errno 39] Directory not empty: 'tests'

241 views
Skip to first unread message

Henrik R.

unread,
Feb 25, 2020, 1:56:59 PM2/25/20
to Kivy users support
I can't seem to find anyone anywhere on the Internet, who has seen this error from Buildozer.

The command I use (in Terminal in Ubuntu 18.04.4 LTS) is: $ buildozer android release

And the part of the log output that shows an error looks like this:

# Run '/usr/bin/python3 -m pythonforandroid.toolchain create --dist_name=GeoESPtrainingTEST --bootstrap=sdl2 --requirements=python3,kivy,pil,sqlite3,pygments,docutils --arch armeabi-v7a --copy-libs --color=always --storage-dir="/mnt/4AF15A0435E762B4/DataDoc/OneDrive/PycharmProjects/2d-graphics/touchtracer/.buildozer/android/platform/build-armeabi-v7a" --ndk-api=21'
# Cwd /mnt/4AF15A0435E762B4/DataDoc/OneDrive/PycharmProjects/2d-graphics/touchtracer/.buildozer/android/platform/python-for-android
[INFO]:    Will compile for the following archs: armeabi-v7a
[INFO]:    Found Android API target in $ANDROIDAPI: 27
[INFO]:    Available Android APIs are (27)
[INFO]:    Requested API target 27 is available, continuing.
[INFO]:    Found NDK dir in $ANDROIDNDK: /home/henrik/.buildozer/android/platform/android-ndk-r19b
[INFO]:    Found NDK version 19b
[INFO]:    Getting NDK API version (i.e. minimum supported API) from user argument
[INFO]:    Found virtualenv at /usr/local/bin/virtualenv
[INFO]:    ccache is missing, the build will not be optimized in the future.
[INFO]:    Found the following toolchain versions: ['4.9']
[INFO]:    Picking the latest gcc toolchain, here 4.9
[INFO]:    Of the existing distributions, the following meet the given requirements:
[INFO]:        GeoESPtrainingTEST: min API 21, includes recipes (freetype, hostpython3, jpeg, libffi, openssl, png, sdl2_image, sdl2_mixer, sdl2_ttf, sqlite3, python3, sdl2, setuptools, pil, six, pyjnius, android, kivy, docutils, pygments), built for archs (armeabi-v7a)
[INFO]:    GeoESPtrainingTEST has compatible recipes, using this one
# Build the application #4
# Copy application source from /mnt/4AF15A0435E762B4/DataDoc/OneDrive/PycharmProjects/2d-graphics/touchtracer
Traceback (most recent call last):
  File "/usr/local/bin/buildozer", line 11, in <module>
    load_entry_point('buildozer==0.40.dev0', 'console_scripts', 'buildozer')()
  File "/usr/local/lib/python3.6/dist-packages/buildozer-0.40.dev0-py3.6.egg/buildozer/scripts/client.py", line 13, in main
    Buildozer().run_command(sys.argv[1:])
  File "/usr/local/lib/python3.6/dist-packages/buildozer-0.40.dev0-py3.6.egg/buildozer/__init__.py", line 1071, in run_command
    self.target.run_commands(args)
  File "/usr/local/lib/python3.6/dist-packages/buildozer-0.40.dev0-py3.6.egg/buildozer/target.py", line 92, in run_commands
    func(args)
  File "/usr/local/lib/python3.6/dist-packages/buildozer-0.40.dev0-py3.6.egg/buildozer/target.py", line 140, in cmd_release
    self.buildozer.build()
  File "/usr/local/lib/python3.6/dist-packages/buildozer-0.40.dev0-py3.6.egg/buildozer/__init__.py", line 211, in build
    self.build_application()
  File "/usr/local/lib/python3.6/dist-packages/buildozer-0.40.dev0-py3.6.egg/buildozer/__init__.py", line 738, in build_application
    self._copy_application_sources()
  File "/usr/local/lib/python3.6/dist-packages/buildozer-0.40.dev0-py3.6.egg/buildozer/__init__.py", line 757, in _copy_application_sources
    rmtree(self.app_dir)
  File "/usr/lib/python3.6/shutil.py", line 486, in rmtree
    _rmtree_safe_fd(fd, path, onerror)
  File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  File "/usr/lib/python3.6/shutil.py", line 424, in _rmtree_safe_fd
    _rmtree_safe_fd(dirfd, fullname, onerror)
  [Previous line repeated 2 more times]
  File "/usr/lib/python3.6/shutil.py", line 428, in _rmtree_safe_fd
    onerror(os.rmdir, fullname, sys.exc_info())
  File "/usr/lib/python3.6/shutil.py", line 426, in _rmtree_safe_fd
    os.rmdir(name, dir_fd=topfd)
OSError: [Errno 39] Directory not empty: 'tests'

Can anyone tell me anything about what is wrong?

(I could try to find a folder called 'tests', but there are none under "/usr/lib/python3.6/" and 11 under "/usr/lib/python3/", and the file "/usr/lib/python3.6/shutil.py" doesn't contain the word 'tests'...)

Robert Flatt

unread,
Feb 25, 2020, 8:55:14 PM2/25/20
to Kivy users support
It looks like the fail is in a copy from  /mnt/4AF15A0435E762B4/DataDoc/OneDrive/PycharmProjects/2d-graphics/touchtracer
Wild guess, it is copying to <project>/.buildozer
Is 'tests' in one of those?

If nobody else sees this issue, it is possible it is a local configuration issue.
It looks like a failure to delete a file under tests.
Perhaps check the permissions/ownership of all files in the project?

Henrik R.

unread,
Feb 26, 2020, 6:34:05 AM2/26/20
to Kivy users support
There are approximately 100 folders called 'tests' under .../touchtracer/.buildozer ...!
I have experienced recently that deleting the .buildozer folder solved a similar problem. Is that 'the best shot' here?

Robert Flatt

unread,
Feb 26, 2020, 12:24:47 PM2/26/20
to Kivy users support
That probably means we are looking in the right place ;)

I have no idea what the best shot is because the issue is probably some local configuration thing.

Deleting <project>/.buildozer is easy to try.
Did you check the permissions/ownership of all the files in the 'copy from' directory?

Henrik R.

unread,
Feb 26, 2020, 1:07:03 PM2/26/20
to Kivy users support
Earlier I have been able to compile my project and deploy and run it directly on my android phone with a USB connection.
The permissions of the (few) files in the project folder is:
-rwxrwxrwx
I haven't looked at all the huge amount of folders in '.buildozer' and 'venv', but it seems to be something general. Also in the directory mentioned in the log:
/mnt/4AF15A0435E762B4/DataDoc/
OneDrive/PycharmProjects/2d-graphics/touchtracer/.buildozer/android/platform/python-for-android
So I guess I will try deleting the '.buildozer' folder.

Henrik R.

unread,
Feb 27, 2020, 2:48:14 PM2/27/20
to Kivy users support
Well... The problem was solved - either by deleting the '.buildozer' folder in the project folder or by closing the Terminal, restarting Ubuntu, open Terminal again and do the 4 export commands again:

 $ export P4A_RELEASE_<*>=<*>
Reply all
Reply to author
Forward
0 new messages