Menu
Who Do Is
  • Home
  • What
  • How
  • Is
  • Can
  • Are
  • Does
  • Do
  • Why
  • Who
  • Where
  • Which
  • Which
  • Should
  • Will
  • When
  • What’s
  • Did
Who Do Is

[ANSWERED] python 3.x – kivy android AttributeError: ‘NoneType’ object has no attribute ‘play’

Posted on November 14, 2022

Solution 1 :

I found the solution
the problem was in audio file extension , mp3 files for some reason are not working when I converted the mp3 file to wav extension it worked flawlessly
also wav keyword must be in the buildozer init

Solution 2 :

NoneType means that your function call failed or it returned an unexpected result.

In your case,

self.sound expects to load the mp3 file and when it is called by self.sound.play(), the file was either not fetched or it returned an unexpected result

Problem :

import kivy
from kivy.app import App
from kivy.uix.button import Label
from kivy.core.audio import SoundLoader

class HelloApp(App):
    def build(self):
        self.sound = SoundLoader.load('back.mp3') # open the background music
        self.sound.play() # play the sound
        return Label(text='>>>>>')
if __name__=="__main__":
    HelloApp().run()

this is my code it works fine on linux
but when i try to make apk by buildozer
the app crashes upon start
and the logcat command gives this

[WARNING] [Audio ] Unable to find a loader for <back.mp3>
: Traceback (most recent call last):
: File “/home/moh/audio2/.buildozer/android/app/main.py”, line 15, in
: File “/home/moh/audio2/.buildozer/android/platform/build-armeabi-v7a/build/python-installs/myapp/kivy/app.py”, line 829, in run
File “/home/moh/audio2/.buildozer/android/app/main.py”, line 9, in build
AttributeError: ‘NoneType’ object has no attribute ‘play’
Python for android ended.

Comments

Comment posted by fsu870

how can I know what is the problem if it works fine on pc but on android it gives this attribute error

Comment posted by Jimit Vaghela

@fsu870 As I mentioned, the error is generated when the argument is failed to call the function. That is, NoneType of your object, which is loading the .mp3 file from some location. It is not being fetched from that location.

READ  [ANSWERED] xml - How to avoid margin above the TextView in android studio?
Powered by Inline Related Posts

Recent Posts

  • How can I play with my cat without toys?
  • What is a bag pipe band called?
  • Are Honda Civics actually fast?
  • Are Yankee candles toxic?
  • How do I pair my Michael Kors smartwatch with my Android?

Recent Comments

No comments to show.

Archives

  • January 2023
  • December 2022
  • November 2022
  • October 2022
  • September 2022

Categories

  • ¿Cómo
  • ¿Cuál
  • ¿Cuántas
  • ¿Cuánto
  • ¿Que
  • ¿Quién
  • 90” and 108” so you may have to round up to the nearest size.
  • and delete any Spotify folders from it. Once this is done
  • Android
  • Are
  • At
  • Bei
  • blink
  • C'est
  • Can
  • carbs
  • Comment
  • Did
  • Do
  • Does
  • During
  • For
  • Has
  • How
  • In
  • Is
  • Ist
  • Kann
  • Können
  • nouveau
  • On
  • or 108 inches.2020-08-03
  • Où
  • owning
  • Pourquoi
  • Puis-je
  • Quand
  • Quante
  • Quel
  • Quelle
  • Quelles
  • Quels
  • Qui
  • Should
  • Sind
  • Sollte
  • spiritual
  • tap the downward-facing arrow on the top left. A downward-facing arrow will appear underneath each song in the album; they'll turn green as the download completes.2020-07-28
  • Uncategorized
  • Wann
  • Warum
  • Was
  • Welche
  • Welcher
  • Welches
  • Welke
  • Wer
  • Were
  • What
  • What's
  • When
  • Where
  • Which
  • Who
  • Whose
  • Why
  • Wie
  • Will
  • Wo
  • Woher
  • you will receive two curtains each with the same measurements of width 66"" (168cm) x drop 54""(137cm).
  • you'll see a green downward-facing arrow next to each song.2021-02-26
©2023 Who Do Is | Powered by SuperbThemes & WordPress