Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
AttributeError: 'str' object has no attribute 'write' en android #22108
Comments
|
English only. |
|
I am trying to download audio and videos using kivy. the code works fine in windows and ubuntu but generates an error in android. This is the code: importar youtube_dl import kivy from kivy.app import App desde kivy.config import Config clase Contenedor_01 (BoxLayout): def descargarA(self):
clase MainApp (aplicación): if name == ' main ': I get this error: I / python (20086): Android kivy bootstrap hecho. el nombre es I / python principal I can't solve this problem |
|
I am getting the same error. Have anybody solve this issue ?? Or even found a workaround to this issue. |
I am trying to download audio and videos using kivy. the code works fine in windows and ubuntu but it generates an error in android.
this is the code:
import youtube_dl
import kivy
kivy.require('1.11.0')
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.config import Config
Config.set('graphics', 'width', 400)
Config.set('graphics', 'height', 200)
class Contenedor_01(BoxLayout):
class MainApp(App):
def build(self):
return Contenedor_01()
if name == 'main':
MainApp().run()
me genera este error:
I/python (20086): Android kivy bootstrap done. name is main
I/python (20086): AND: Ran string
I/python (20086): Run user program, change dir and execute entrypoint
I/python (20086): [WARNING] [Config ] Older configuration version detected (0 instead of 21)
I/python (20086): [WARNING] [Config ] Upgrading configuration in progress.
I/python (20086): [INFO ] [Logger ] Record log in /data/user/0/org.test.downloadmeapp/files/app/.kivy/logs/kivy_19-08-15_0.txt
I/python (20086): [INFO ] [Kivy ] v1.11.0
I/python (20086): [INFO ] [Kivy ] Installed at "/data/user/0/org.test.downloadmeapp/files/app/_python_bundle/site-packages/kivy/init.pyc"
I/python (20086): [INFO ] [Python ] v3.7.1 (default, Aug 15 2019, 15:27:31)
I/python (20086): [Clang 6.0.2 (https://android.googlesource.com/toolchain/clang 183abd29fc496f55
I/python (20086): [INFO ] [Python ] Interpreter at "android_python"
I/python (20086): [INFO ] [Factory ] 184 symbols loaded
I/python (20086): [INFO ] [Image ] Providers: img_tex, img_dds, img_sdl2, img_gif (img_pil, img_ffpyplayer ignored)
I/python (20086): [INFO ] [Window ] Provider: sdl2
I/python (20086): [INFO ] [GL ] Using the "OpenGL ES 2" graphics system
I/python (20086): [INFO ] [GL ] Backend used
I/python (20086): [INFO ] [GL ] OpenGL version <b'OpenGL ES 3.1 V@140.0 (GIT@Iec24cdb30f)'>
I/python (20086): [INFO ] [GL ] OpenGL vendor <b'Qualcomm'>
I/python (20086): [INFO ] [GL ] OpenGL renderer <b'Adreno (TM) 405'>
I/python (20086): [INFO ] [GL ] OpenGL parsed version: 3, 1
I/python (20086): [INFO ] [GL ] Texture max size <16384>
I/python (20086): [INFO ] [GL ] Texture max units <16>
I/python (20086): [INFO ] [Window ] auto add sdl2 input provider
I/python (20086): [INFO ] [Window ] virtual keyboard not allowed, single mode, not docked
I/python (20086): [INFO ] [Text ] Provider: sdl2
I/python (20086): [WARNING] [Base ] Unknown provider
I/python (20086): [INFO ] [Base ] Start application main loop
I/python (20086): [INFO ] [GL ] NPOT texture support is available
I/python (20086): [INFO ] [Base ] Leaving application in progress...
I/python (20086): Traceback (most recent call last):
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/app/main.py", line 38, in
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/app.py", line 855, in run
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/base.py", line 504, in runTouchApp
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/core/window/window_sdl2.py", line 746, in mainloop
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/core/window/window_sdl2.py", line 478, in _mainloop
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/base.py", line 342, in idle
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/base.py", line 327, in dispatch_input
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/base.py", line 233, in post_dispatch_input
I/python (20086): File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/core/window/init.py", line 1378, in on_motion
I/python (20086): File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/core/window/init.py", line 1394, in on_touch_down
I/python (20086): File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/uix/widget.py", line 549, in on_touch_down
I/python (20086): File "kivy/_event.pyx", line 707, in kivy._event.EventDispatcher.dispatch
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/uix/behaviors/button.py", line 151, in on_touch_down
I/python (20086): File "kivy/_event.pyx", line 703, in kivy._event.EventDispatcher.dispatch
I/python (20086): File "kivy/_event.pyx", line 1214, in kivy._event.EventObservers.dispatch
I/python (20086): File "kivy/_event.pyx", line 1098, in kivy._event.EventObservers._dispatch
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/kivy/lang/builder.py", line 64, in custom_callback
I/python (20086): File "/data/data/org.test.downloadmeapp/files/app/main.kv", line 4, in
I/python (20086): on_press: root.descargarA()
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/app/main.py", line 29, in descargarA
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/YoutubeDL.py", line 2010, in download
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/YoutubeDL.py", line 796, in extract_info
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/common.py", line 530, in extract
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/youtube.py", line 1668, in _real_extract
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/common.py", line 794, in _download_webpage
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/youtube.py", line 274, in _download_webpage_handle
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/common.py", line 660, in _download_webpage_handle
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/common.py", line 602, in _request_webpage
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/common.py", line 922, in report_download_webpage
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/extractor/common.py", line 914, in to_screen
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/YoutubeDL.py", line 502, in to_screen
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/YoutubeDL.py", line 516, in to_stdout
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/YoutubeDL.py", line 505, in _write_string
I/python (20086): File "/home/abrahan/Escritorio/prueba/.buildozer/android/platform/build/build/python-installs/DownLoadMeApp/youtube_dl/utils.py", line 3084, in write_string
I/python (20086): AttributeError: 'str' object has no attribute 'write'
I/python (20086): Python for android ended.
I can't solve this problem