-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IOError: [Errno 2] No such file or directory: 'src/main/assets/private.mp3' #1257
Comments
I detected the same problem, when I tried to update an existing (working) build from version 0.5.3 to version 0.6.0. It simply helped to add the missing directories to .... bootstraps/sdl2/build/main/... in the pythonforandroid installation. My init-script now looks like:
There seems to be a problem somewhere in the setup of pythonforandroid. Also I suggest the build.py script should better check for directories - and fix them if necessary - before creating files. |
Here is a patch that applies to the unpacked 0.6.0.zip:
to be saved to 0.6.0.patch, then (e.g):
|
@lufebe16 is this fixed then, should we not close the ticket? |
I'm on Ubuntu 16.04 (Linux). I'm getting this error at "getting started guide" from https://python-for-android.readthedocs.io/en/latest/quickstart/ with main.py containing hello world example from https://kivy.org/docs/guide/basic.html.
I installed Android Studio with Android SDK and NDK from https://developer.android.com/studio/index.html.
APK-Building was invoked in python virtualenv (because of pip install python-for-android) by following command.
p4a apk --private $HOME/src/kivy --package=org.example.myapp --name "My application" --version 0.1 --bootstrap=sdl2 --requirements=python2,kivy --sdk_dir $HOME/Android/Sdk --ndk_dir ~/Android/Sdk/ndk-bundle --ndk_version r16b
Any idea why building stopped at the following point:
(Thank you in advance...)
Compiling /home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/private/lib/python2.7/xml/sax/xmlreader.py ... Traceback (most recent call last): File "/home/sjuk/env/p4a/bin/p4a", line 11, in <module> sys.exit(main()) File "/home/sjuk/env/p4a/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 975, in main ToolchainCL() File "/home/sjuk/env/p4a/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 512, in __init__ getattr(self, args.subparser_name.replace('-', '_'))(args) File "/home/sjuk/env/p4a/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 150, in wrapper_func func(self, args) File "/home/sjuk/env/p4a/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 754, in apk build_args = build.parse_args(args.unknown_args) File "/home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.py", line 567, in parse_args make_package(args) File "/home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.py", line 248, in make_package make_tar('src/main/assets/private.mp3', tar_dirs, args.ignore_path) File "/home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.py", line 187, in make_tar tf = tarfile.open(tfn, 'w:gz', format=tarfile.USTAR_FORMAT) File "/usr/lib/python2.7/tarfile.py", line 1691, in open return func(name, filemode, fileobj, **kwargs) File "/usr/lib/python2.7/tarfile.py", line 1738, in gzopen fileobj = gzip.GzipFile(name, mode, compresslevel, fileobj) File "/usr/lib/python2.7/gzip.py", line 94, in __init__ fileobj = self.myfileobj = __builtin__.open(filename, mode or 'rb') IOError: [Errno 2] No such file or directory: 'src/main/assets/private.mp3'
$ mkdir .local/share/python-for-android/dists/unnamed_dist_1/src/main/assets
and
$ touch .local/share/python-for-android/dists/unnamed_dist_1/src/main/assets/private.mp3
gives me the next complain about another missing file.
Traceback (most recent call last): File "/home/sjuk/env/kivyinstall/bin/p4a", line 11, in <module> sys.exit(main()) File "/home/sjuk/env/kivyinstall/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 975, in main ToolchainCL() File "/home/sjuk/env/kivyinstall/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 512, in __init__ getattr(self, args.subparser_name.replace('-', '_'))(args) File "/home/sjuk/env/kivyinstall/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 150, in wrapper_func func(self, args) File "/home/sjuk/env/kivyinstall/local/lib/python2.7/site-packages/pythonforandroid/toolchain.py", line 754, in apk build_args = build.parse_args(args.unknown_args) File "/home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.py", line 567, in parse_args make_package(args) File "/home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.py", line 260, in make_package shutil.copy(args.icon or default_icon, 'src/main/res/drawable/icon.png') File "/usr/lib/python2.7/shutil.py", line 119, in copy copyfile(src, dst) File "/usr/lib/python2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: 'src/main/res/drawable/icon.png'
$ mkdir .local/share/python-for-android/dists/unnamed_dist_1/src/main/res/drawable
$ touch .local/share/python-for-android/dists/unnamed_dist_1/src/main/res/drawable/icon.png
got to the next error...
`INFO: Selecting java build tool:
INFO: Detected highest available build tools version to be 28.0.0-rc1
INFO: Building with ant, as no gradle executable detected
INFO: -> running ant debug
working: Total time: 0 seconds Exception in thread background thread for pid 3720:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/sjuk/env/kivyinstall/local/lib/python2.7/site-packages/sh.py", line 2170, in background_thread
handle_exit_code(exit_code)
File "/home/sjuk/env/kivyinstall/local/lib/python2.7/site-packages/sh.py", line 1929, in fn
return self.command.handle_command_exit_code(exit_code)
File "/home/sjuk/env/kivyinstall/local/lib/python2.7/site-packages/sh.py", line 672, in handle_command_exit_code
raise exc
ErrorReturnCode_1:
RAN: /usr/bin/ant debug
STDOUT:
Buildfile: /home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.xml
BUILD FAILED
/home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.xml:93: Cannot find /home/sjuk/Android/Sdk/tools/ant/build.xml imported from /home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.xml
Total time: 0 seconds
STDERR:
Buildfile: /home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.xml
BUILD FAILED
/home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.xml:93: Cannot find /home/sjuk/Android/Sdk/tools/ant/build.xml imported from /home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1/build.xml
Total time: 0 seconds
INFO: STDERR:
cd /home/sjuk/.local/share/python-for-android/dists/unnamed_dist_1 && /usr/bin/ant debug
[WARNING]: ERROR: /usr/bin/ant failed!`
The text was updated successfully, but these errors were encountered: