Python Forum
how to suppress not to display the package contents from pydoc!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to suppress not to display the package contents from pydoc!
#1
Hi All,

Below is my sample code, where I do not want to display the PACKAGE CONTENTS section (means I wanted to suppress this, as not to display it) while issuing the command as pydoc3 -w mymodule

NAME
    whatever - This is whatever help info.

FILE
    /home/el/whatever/__init__.py

DESCRIPTION
    This is whatever description

    EXAMPLES:
        ...

PACKAGE CONTENTS
    nothing (package)
    something

DATA
    __version__ = '1.0'
    variable = 'variable'

VERSION
    1.0
any suggestion on this? thanks a lot.
Regards,
maiya
Reply
#2
what you are showing is not sample code.
It looks more like a document header.
Please post your code.
Reply
#3
(Mar-18-2021, 10:19 AM)Larz60+ Wrote: what you are showing is not sample code.
It looks more like a document header.
Please post your code.

Quote:No Sir, actually when I issue pydoc3 -w mymodule
where in the document PACKAGE CONTENTS section also display, but I do not want pydoc3 to display the PACKAGE CONTENTS section. So suppress this section.
Is there any command to do so? or in my code possible to do so? or in pydoc code is possible to do so? or it is pydoc feature and we cannot do anything with this pydoc feature.?
Reply
#4
Looks like pydoc simply sees if the module has a __path__ attribute. If it does, it creates the section and adds all the objects inside to the section. So I assume you have a multi-file module? Are you using a __init__.py file?

Maybe if you had one you could try deleting the path variable if it thought that pydoc was being run. That doesn't seem very safe, but it might work. Something like:

import sys
if "pydoc" in sys.argv[0]:
    del __path__
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Information Unable to display joystick's value from Python onto display box MelfoyGray 2 654 Nov-11-2020, 02:23 AM
Last Post: MelfoyGray
  Keyboard Module Python - Suppress input while writing to window ppel123 0 1,099 Apr-08-2020, 02:51 PM
Last Post: ppel123
  Pydoc documentation doesnt work Cosmosso 4 1,718 Dec-13-2019, 08:21 AM
Last Post: Cosmosso
  display the contents of a sqlite3 database according to the dates atlass218 4 1,444 Mar-03-2019, 06:43 AM
Last Post: atlass218
  How to display <IPython.core.display.HTML object>? pythopen 2 31,516 Oct-17-2018, 06:22 PM
Last Post: pythopen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020