Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    TypeError: 'module' object is not callable

    Scheduled Pinned Locked Moved LoPy
    deep sleep shiddeep sleeplibrarylopyexpansion board
    11 Posts 5 Posters 5.6k Views 5 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • R Offline
      Rachelsimida
      last edited by

      This is my device. 0_1522414421476_bd41dd1f-2625-4387-9340-de3099824a68-image.png

      1 Reply Last reply Reply Quote 0
      • J Offline
        jcaron
        last edited by

        I believe you should have deepsleep.py directly in the lib folder, not a subfolder.

        R 1 Reply Last reply Reply Quote 0
        • R Offline
          Rachelsimida @jcaron
          last edited by

          @jcaron I tried but still fail.0_1522416923781_b54165aa-8551-4720-a011-25df8be45387-image.png

          robert-hhR 1 Reply Last reply Reply Quote 0
          • robert-hhR Offline
            robert-hh @Rachelsimida
            last edited by

            @rachelsimida if you type in the REPL prompt:

            from deepsleep import DeepSleep
            dir (DeepSleep)
            

            What do you get as output?

            R 1 Reply Last reply Reply Quote 0
            • R Offline
              Rachelsimida @robert-hh
              last edited by

              @robert-hh 0_1522422050423_744947d6-62bd-4ca4-9d05-4e9ec750edd6-image.png

              1 Reply Last reply Reply Quote 0
              • J Offline
                jcaron
                last edited by

                The errors do not seem to be very consistent. Note that Pymakr uploads files it knows about but it can leave odd stuff on the module's filesystem.

                I recommend you either use FTP to check that you only have the files required, or clear the flash and then re-upload with Pymakr, it should help.

                Also, don't add all those other files in lib, you'll end up with issues.

                R 1 Reply Last reply Reply Quote 0
                • N Offline
                  nathanh
                  last edited by

                  Would it be because you have the directory as /Lib instead of /lib (i.e. try using lowercase).

                  R 1 Reply Last reply Reply Quote 0
                  • R Offline
                    Rachelsimida @nathanh
                    last edited by

                    @nathanh Thaks. I tried. It still the same problem.

                    1 Reply Last reply Reply Quote 0
                    • R Offline
                      Rachelsimida @jcaron
                      last edited by

                      @jcaron Thank you. I tried but still like this, I don't know why it's so complicated.
                      0_1522429924401_11fc2968-19ce-49de-8853-1b51e65584cf-image.png
                      I run the deepsleep.py and there is no action in the console, if the deepsleep code is right. I downloaded from there.
                      https://github.com/pycom/pycom-libraries/tree/master/deepsleep
                      0_1522430148933_e30bfb96-f357-4737-8873-299c3bc69a76-image.png

                      1 Reply Last reply Reply Quote 0
                      • C Offline
                        cronywalls
                        last edited by

                        This error statement TypeError: 'module' object is not callable is raised as you are being confused about the Class name and Module name. The problem is in the import line . You are importing a module, not a class. This happend because the module name and class name have the same name .

                        If you have a class "MyClass" in a file called "MyClass.py" , then you should import :

                        from MyClass import MyClass
                        

                        In Python , a script is a module, whose name is determined by the filename . So when you start out your file MyClass.py with import MyClass you are creating a loop in the module structure.

                        In Python, everything (including functions, methods, modules, classes etc.) is an object , and methods are just attributes like every others. So,there's no separate namespaces for methods. So when you set an instance attribute, it shadows the class attribute by the same name. The obvious solution is to give attributes different names.

                        1 Reply Last reply Reply Quote 1

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • 1 / 1
                        • First post
                          Last post

                        Pycom on Twitter

                        Pycom