Page 1 of 1

help('modules'), nodeMCU, Thonny

Posted: Mon Jan 11, 2021 8:24 pm
by ctvarlan
Hi,
I am new with microPython and I consider this a good excuse for my post.

I just installed Thonny 3.3 and microPython on nodeMCU v3. Following the invitation to type help(obj) with help('modules'), I got this list:

Code: Select all

__main__          machine           ubinascii         ure
_boot             math              ucollections      urequests
_onewire          micropython       ucryptolib        urllib/urequest
_uasyncio         neopixel          uctypes           uselect
_webrepl          network           uerrno            usocket
apa102            ntptime           uhashlib          ussl
btree             onewire           uheapq            ustruct
builtins          port_diag         uio               usys
dht               ssd1306           ujson             utime
ds18x20           uarray            umqtt/robust      utimeq
esp               uasyncio/__init__ umqtt/simple      uwebsocket
flashbdev         uasyncio/core     uos               uzlib
framebuf          uasyncio/event    upip              webrepl
gc                uasyncio/funcs    upip_utarfile     webrepl_setup
inisetup          uasyncio/lock     upysh             websocket_helper
lwip              uasyncio/stream   urandom
Plus any modules on the filesystem
It looks really great, but if I continue with help('whatever module name'), then I just get an immutable list of:

Code: Select all

help('whatever module name')
object whatever module name is of type str
  encode -- <function>
  find -- <function>
  rfind -- <function>
  index -- <function>
  rindex -- <function>
  join -- <function>
  split -- <function>
  rsplit -- <function>
  startswith -- <function>
  endswith -- <function>
  strip -- <function>
  lstrip -- <function>
  rstrip -- <function>
  format -- <function>
  replace -- <function>
  count -- <function>
  lower -- <function>
  upper -- <function>
  isspace -- <function>
  isalpha -- <function>
  isdigit -- <function>
  isupper -- <function>
  islower -- <function>
I changed, up and down, the version of MP, I changed, up and down, the version of Thonny. No change in the structure of obj.

I think that, maybe, is not enough memory on ESP8266 to keep all the text for help purposes. But anyway, no error message or something to tell me I am wrong and look elsewhere.

Am I wrong? Where should I look to have a help(obj) as the invitation shows?

Any help would be greatly appreciated.

Re: help('modules'), nodeMCU, Thonny

Posted: Mon Jan 11, 2021 11:59 pm
by jimmo
ctvarlan wrote:
Mon Jan 11, 2021 8:24 pm
It looks really great, but if I continue with help('whatever module name'), then I just get an immutable list of:
help('modules') is a special case of the help function. i.e. it specifically understands that the string "modules" is special.

Normally you write

help(foo)

where foo is a type or module or function that has a docstring.

So what's going on here is that help('something') is saying 'something' is a str(ing) so I'm going to give you the help for the type "str".

So for help on a specific module, you first need to import it, then pass the module itself to help().

Code: Select all

import math
help(math)

Re: help('modules'), nodeMCU, Thonny

Posted: Tue Jan 12, 2021 2:09 am
by ctvarlan
Hi jimmo,

This make senses. Thank you, that solves my beginner problem.

Have a great day and stay safe!