Skip to content

no module named tty #1165

Closed
Closed

Description

@sm-jalali-f

i'm running testapp in your repository but when run application it crashe.
log cat error show this :
11-10 21:06:50.949 17674 17698 I python : Traceback (most recent call last):
11-10 21:06:50.949 17674 17698 I python : File "/home/mohamad/PycharmProjects/kivyDeepLearn/.buildozer/android/app/main.py", line 5, in
11-10 21:06:50.949 17674 17698 I python : File "/home/mohamad/PycharmProjects/kivyDeepLearn/.buildozer/android/platform/build/dists/kivyAndcai/private/lib/python2.7/site-packages/pythonforandroid/recipes/android/init.py", line 1, in
11-10 21:06:50.950 17674 17698 I python : File "/home/mohamad/PycharmProjects/kivyDeepLearn/.buildozer/android/platform/build/dists/kivyAndcai/private/lib/python2.7/site-packages/pythonforandroid/recipe.py", line 10, in
11-10 21:06:50.950 17674 17698 I python : File "/home/mohamad/PycharmProjects/kivyDeepLearn/.buildozer/android/platform/build/dists/kivyAndcai/private/lib/python2.7/site-packages/sh.py", line 96, in
11-10 21:06:50.950 17674 17698 I python : File "/home/mohamad/PycharmProjects/kivyDeepLearn/.buildozer/android/platform/build/build/other_builds/python2/armeabi-v7a/python2/python-install/lib/python2.7/pty.py", line 11, in
11-10 21:06:50.950 17674 17698 I python : ImportError: No module named tty

how to fix it???

Activity

  1. inclement commented on Nov 10, 2017

    @inclement
    Member

    The tty module isn't included in the apk as a minor optimisation (almost nothing uses it). You can un-blacklist it if necessary using the whitelist options of buildozer/python-for-android. The term to whilelist is tty.pyo.

    Also, you say you're using one of the testapps, but the traceback seems to indicate the code is trying to use the sh module. Is this something you added to the testapp, or did you change anything else away from the parameters in the repository?

  2. sm-jalali-f commented on Nov 12, 2017

    @sm-jalali-f
    Author

    My problem is solved. i remove sh library.
    but i write my program that receive intent in android app.
    my code is:

    from kivy.app import App
    from pythonforandroid.recipes.android.src.android.broadcast import BroadcastReceiver
    
    class MyApp(App):
        # def __init__(self, **kwargs):
        #     super().__init__(**kwargs)
        #     print("init")
    
        def build(self):
            print("build")
            self.br = BroadcastReceiver(self.on_broadcast, actions=['new_picture_added'])
            self.br.start()
            
    
        def on_broadcast(self, context, intent):
            extras = intent.getExtras()
            pictureAddress = str(extras.get('picture_address'))
            print(pictureAddress)
            self.out.write("onBroadcast\n")
    
        def on_pause(self):
            self.br.stop()
            print("onPause")
            self.out.write("onPause")
            return super(MyApp, self).on_pause()
    
    
        def on_resume(self):
            self.br.start()
            print("onResume")
            self.out.write("onResume")
            super(MyApp, self).on_resume()
    
    
    
    if __name__ == '__main__':
        MyApp().run()
    
    

    and add python-for-android in requirement on spec file like this:
    requirements = kivy,python-for-android
    but when build and run android application with this command:
    sudo buildozer android debug deploy run logcat
    when running this error occured:
    11-12 21:49:53.843 2872 2909 I python : Traceback (most recent call last):
    11-12 21:49:53.843 2872 2909 I python : File "/home/mohamad/PycharmProjects/kivyDeepLearn/.buildozer/android/app/main.py", line 5, in
    11-12 21:49:53.843 2872 2909 I python : ImportError: No module named pythonforandroid.recipes.android.src.android.broadcast
    11-12 21:49:53.861 2872 2909 I python : Python for android ended.

    what is my mistake?

  3. inclement commented on Nov 12, 2017

    @inclement
    Member

    python-for-android is a build tools for Android, you don't need or want it in your app itself. You just want the android module, so include that in your requirements and import from there.

  4. sm-jalali-f commented on Nov 12, 2017

    @sm-jalali-f
    Author

    I change requirements line to this but not work. and error occured again
    requirements = kivy,android

  5. inclement commented on Nov 12, 2017

    @inclement
    Member

    Please post the details of the error on the kivy-users mailing list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions