On Saturday, December 12, 2015 at 7:36:21 PM UTC-5, Peter Otten wrote: > Robert wrote: > > > On Saturday, December 12, 2015 at 7:05:39 PM UTC-5, Robert wrote: > >> On Saturday, December 12, 2015 at 6:24:25 PM UTC-5, Erik wrote: > >> > On 12/12/15 23:08, Robert wrote: > >> > > In fact, I wanted to run the following code. When it failed, I moved > >> > > to the original question above. > >> > > >> > How did it fail? Tell us what _did_ happen. > >> > > >> > It works fine for me: > >> > > >> > $ pydoc module1 > >> > Help on module module1: > >> > > >> > NAME > >> > module1 > >> > > >> > FILE > >> > /tmp/robert/module1.py > >> > > >> > DATA > >> > a = 'A' > >> > b = 'B' > >> > c = 'C' > >> > > >> > > >> > $ pydoc module2 > >> > Help on module module2: > >> > > >> > NAME > >> > module2 > >> > > >> > FILE > >> > /tmp/robert/module2.py > >> > > >> > DATA > >> > __all__ = ['a', 'b'] > >> > a = 'A' > >> > b = 'B' > >> > > >> > E. > >> > >> Excuse me for the incomplete information on previous posts. > >> Here is the message when I run it on Canopy (module1.py and module2.py > >> are in the current folder): > >> > >> Welcome to Canopy's interactive data-analysis environment! > >> with pylab-backend set to: qt > >> Type '?' for more information. > >> > >> In [1]: pydoc module1 > >> File "<ipython-input-1-cebe02de9045>", line 1 > >> pydoc module1 > >> ^ > >> SyntaxError: invalid syntax > >> > >> > >> In [2]: > >> > >> > >> The above code snippet is from here: > >> http://stackoverflow.com/questions/44834/can-someone-explain-all-in-python > >> > >> Thanks again. > > > > Hi, > > It turns out that Enthought does not allow pydoc as the link said: > > http://stackoverflow.com/questions/12063718/using-help-and-pydoc-to-list-python-modules-not-working > > This is completely unrelated. > > >>> help("modules") > > for the specific string "modules" triggers a scan for all available modules. > For other strings like "module1" that represent a module name > > >>> help("module1") > > should work unless > > >>> import module1 > > fails, too.
Thanks Peter and others. It previously may not be at the right directory. After that, import pydoc, it works. Great thanks with the following command. pydoc.help('module1') Help on module module1: NAME module1 FILE c:\users\rj\pyprj\module1.py DATA a = 'A' b = 'B' c = 'C' -- https://mail.python.org/mailman/listinfo/python-list