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

    Importing & using external libraries

    Scheduled Pinned Locked Moved Getting Started
    micropython
    6 Posts 2 Posters 3.0k Views 2 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.
    • G Offline
      gdillen
      last edited by

      Hello,

      I'm new to Python (having C/C++ and C# background).

      I'm trying to use the MQTT library https://pypi.python.org/pypi/micropython-umqtt.simple

      import umqtt

      works

      but

      from umqtt import MQTTClient

      gives:
      ImportError: cannot import name MQTTClient

      What am I doing wrong?

      Thanks.

      1 Reply Last reply Reply Quote 0
      • G Offline
        gdillen
        last edited by

        I've got it to work on 1 LoPy but using the exact same code on another LoPy still gives the same problem!
        Probably I'm still doing something wrong, I don't know?!

        So my first impressions:
        I did embedded development for several years in C/C++ without any major problems. So I thought (advertising faster development, etc.) let me start also trying doing some development with a LoPy but I really get frustrated, continuously having problems, ... To me at the contrary I'm losing days in development ... and probably go back to (stable) C/C++ embedded development.

        1 Reply Last reply Reply Quote 0
        • B Offline
          bucknall
          last edited by

          Hi @gdillen,

          Are you using the latest version of the Firmware? If so it might be worth a quick update as this may resolve any of the issues you're having!

          What are you using to upload your libraries to your LoPy? Let me know and I'll try my best to get you up and running!

          Thanks,

          Alex

          Developer Evangelist - Pycom

          G 1 Reply Last reply Reply Quote 0
          • G Offline
            gdillen @bucknall
            last edited by

            @bucknall Thanks. I run Firmware 1.6.7.b1.

            I probably don't understand fully the "development life cycle".

            • On one of my LoPy's I created a test project (connecting/sending LoRaWAN messages) using Pymakr, run main.py and it worked (on this LoPy I didn't any sync in Pymakr or connected using FileZilla to transfer anything)
            • On my other LoPy I created a project in Pymakr and transfered the local (on my laptop/Mac) to the LoPy
              As you can imagine I'm confused as of what's the correct way to develop and deploy on the xxPy? Can you please explain in few words?
              Probably the library problem I have has to do with this?

            By the way running sync in pymakr always results in "failed".

            Thanks for your help.
            Guy

            B 1 Reply Last reply Reply Quote 0
            • B Offline
              bucknall @gdillen
              last edited by

              @gdillen We're aware of some of the issues on-going with Pymakr so for the mean time, we're recommending people utilise a slightly different workflow which will be streamlined when our plugins arrive either next month or the following. We believe there are currently some file corruption issues happening with Pymakr.

              I have two processes I use for development cycle:

              1. Using the MicroPython Interpreter

              I use the built-in serial terminal on Mac OS known as 'screen' to open a USB serial connection to the Pycom Device.

              $ screen /dev/cu.usbserial-*your device* 115200
              

              If the board is connected to your computer it should open up into the REPL, you may need to press ctrl-c to escape a program if there is one running.

              Let me know if you're using Windows I'll suggest an alternative!

              1. Uploading my code to the board using Filezilla (FTP)

              Once I've written my code (I use the Atom editor) and I'm happy with a project, I'll upload it to my device using Filezilla (FTP).

              I place my library files into the 'flash/lib' folder and the rest or my code, boot.py & main.py into 'flash/'.

              You should ensure that you've set Filezilla up in a configuration specified in the link below as there are some slight tweaks to be made!

              https://docs.pycom.io/pycom_esp32/pycom_esp32/toolsandfeatures.html#filezilla-settings

              Developer Evangelist - Pycom

              G 1 Reply Last reply Reply Quote 0
              • G Offline
                gdillen @bucknall
                last edited by

                @bucknall Thanks.
                Using the MicroPython Interpreter
                I use the built-in serial terminal on Mac OS known as 'screen' to open a USB serial connection to the Pycom Device.

                Maybe a stupid question, but why do you serial connect to the xxPy (using eg screen on Mac, the alternative on win I suppose is Putty or TeraTerm)? Pymakr itself has already a serial connection the xxPy? Additionally isn't writing your code as part of a project (in Pymakr) followed by ftp'ing (FileZilla or other) the code/firmware from the Mac or win PC to the xxPy not enough?

                Also, when clicking (in Pymakr) "Run this code' what exactly happens, isn't clear to me? Should I first ftp the code to the xxPy and then click "Run this code", but if so I'm asking myself why, because when you reset the xxPy the code/firmware runs from the xxPy?

                Thanks.
                Guy

                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