PyCharm MicroPython pyb module?

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
kwiley
Posts: 140
Joined: Wed May 16, 2018 5:53 pm
Contact:

PyCharm MicroPython pyb module?

Post by kwiley » Tue May 29, 2018 10:15 pm

I found the MicroPython PyCharm plugin, installed it, and activated it for my project, but references to the pyb module are still unrecognized in my code. I realize pyb isn't really part of MicroPython native, but I also activated the plugin's Pyboard option under the Languages & Frameworks settings (and of course I selected the Enable MicroPython support checkbox). It still doesn't recognize the pyb module in my code however.

Does anyone what I'm missing here?

Thanks.

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: PyCharm MicroPython pyb module?

Post by dhylands » Tue May 29, 2018 11:18 pm

The linter is looking on the host platform for the pyb module, which it can't find.

You can do something like this: https://github.com/dastultz/micropython ... master/lib which introduces a dummy pyb module which typically makes the linter happy.

nmz787
Posts: 29
Joined: Sun Jul 10, 2016 7:57 am

Re: PyCharm MicroPython pyb module?

Post by nmz787 » Wed May 30, 2018 8:57 am

I had to mock a few other files too, to get my code to import without error, and helped me sort out weird errors that MicroPython wasn't raising exceptions for (I think the last had to do with fancy/non-standard quotation characters that somehow made it into my code file after pasting in comments from a PDF).
https://gist.github.com/nmz787/771774b5 ... 36e3006352

kwiley
Posts: 140
Joined: Wed May 16, 2018 5:53 pm
Contact:

Re: PyCharm MicroPython pyb module?

Post by kwiley » Wed May 30, 2018 4:35 pm

Thanks. The dummy file will be good enough for now, since I only intend to run the code on the PyBoard. I am curious about options of integrating PyCharm with the PyBoard for tightly coupled development, but one step at a time. It's nice just to be able to develop code in a completed and checked fashion (as opposed to writing code in a text editor and repeatedly copy/pasting it into the PyBoard's terminal or copying a code file to the PyBoard and rebooting the board).

Cheers!

Post Reply