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

    Pymakr & Python Extension : import pycom module failure

    Scheduled Pinned Locked Moved Discussion
    lopyexpansion boardpymakrpythonmodules
    7 Posts 4 Posters 2.5k Views 4 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.
    • M Offline
      meven
      last edited by

      Hi guys,

      Please be aware that I am a French beginner. Few days ago, I was given an Expension Board 2.0 with a LoPy4. I read the documentation and I obviously began with the "Getting Started" tutorial. First of all, I upgraded the firmware of my LoPy4 as it was required and I have installed Virtual Studio Code with Pymakr extension. I have also installed NodeJS for Pymark extension. From the pycom console itself, I could turn off the LED, change light color etc but once I have installed Python 3.6.5 with Pylint and try to run the first exemple I could not import pycom module. Here's the exemple I was trying to run on my LoPy4 with the error.

      import pycom -> [pylint] E0401: Unable to import "pycom"
      import time

      pycom.heartbeat(False)

      While True:
      pycom.rgbled(0xFF0000) # Red
      time.sleep(1)
      pycom.rgbled(0x00FF00) # Green
      time.sleep(1)
      pycom.rgbled(0x0000FF) # Blue
      time.sleep(1)

      I have tried to load the module pycom with the command "python -m pip install pycom" and it seems to install a pycom package but it doesn't seem to have the elements I have expected... and I went through different forum topics without finding any correct solution.

      Thanks for your help !

      B robert-hhR 2 Replies Last reply Reply Quote 1
      • catalinC Offline
        catalin
        last edited by

        hi @meven,

        This is a pylint error from Visual Studio Code. You can't pip install pycom, this a specific python package built inside Lopy.
        Pylint is a static code analysis tool embedded into VSC, due to .py file extention it was enabled, by default.

        You could ignore that pylint error, or try to disable pylint, like here: https://stackoverflow.com/questions/40626429/windows-10-visual-studio-code-removing-pylint

        Catalin,

        Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
        Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

        M 1 Reply Last reply Reply Quote 0
        • M Offline
          meven @catalin
          last edited by

          Hi @catalin,

          Thanks for your answer ! I tried this solution already, but it seemed silly to me as it's supposed to get errors and warning. Do I need to install another linter as mypy for example ?

          1 Reply Last reply Reply Quote 0
          • catalinC Offline
            catalin
            last edited by

            I'm not sure how to workaround this error. In principle you should be able to suppress pylint checking specific modules.

            The problem is that pylint wants to make sure your python packages do exist (and you're not making some typos). But the python packages (like pycom, and all the ones explained here: https://docs.pycom.io/chapter/firmwareapi/pycom/) are embedded into the Lopy.
            Pylint looks for code-source of these, but they are coded in C.

            Catalin,

            Have you checked out our docs for the answer? (Now with an easy search function) https://docs.pycom.io
            Check out our newly revamped device management platform, Pybytes! https://pybytes.pycom.io/

            1 Reply Last reply Reply Quote 0
            • M Offline
              meven
              last edited by

              At the moment, it seems to work. Thank a lot for your explanations !

              1 Reply Last reply Reply Quote 0
              • B Offline
                bruno.l @meven
                last edited by

                @meven

                What you advised: "python -m pip install pycom" is working for me also, thank you

                However next, I got this error: "[pylint] E1101:Module 'pycom' has no 'heartbeat' member" but I could ignore it by:

                # pylint: disable=maybe-no-member
                pycom.heartbeat(False)
                pycom.rgbled(0xffff00)
                
                1 Reply Last reply Reply Quote 0
                • robert-hhR Offline
                  robert-hh @meven
                  last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 0

                  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