There are no more Python Help topics. Browse all categories or view latest topics.?

There are no more Python Help topics. [Browse all categories]

??

from


Last week installed:
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:43:54) [MSC v.1928 32 bit (In
tel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

followed manual, tested basics functions to work, but how to go one step ahead in Windows 7, 32-bit ?


  1. How to use dir ?

dir

help dir
File “”, line 1
help dir
^
SyntaxError: invalid syntax

  1. Is there pwd in Python ?

  2. How to start using pip ?

pip
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘pip’ is not defined


help(pip)
Traceback (most recent call last):
File “”, line 1, in
NameError: name ‘pip’ is not defined


Set environment path and hoped to use pip, but no chance

Can you help how to start and to know what’s wrong ?

darius

follow-up

Just tested

help(dir)
The name ‘more’ is not recognized as an internal or external command,
executable program or batch file.


I don’t enter “more” , I need to know how to use “dir” from help

darius

At the Python prompt, the command is dir():

>>> dir()
['__annotations__', '__builtins__', '__doc__', '__loader__', '__name__', '__package__', '__spec__']

Not much there when Python has only just been started.

For help:

>>> help(dir)
Help on built-in function dir in module builtins:

dir(...)
    dir([object]) -> list of strings

    If called without an argument, return the names in the current scope.
    Else, return an alphabetized list of names comprising (some of) the attributes
    of the given object, and of attributes reachable from it.
    If the object supplies a method named __dir__, it will be used; otherwise
    the default dir() logic is used and returns:
      for a module object: the module's attributes.
      for a class object:  its attributes, and recursively the attributes
        of its bases.
      for any other object: its attributes, its class's attributes, and
        recursively the attributes of its class's base classes.

pip is used to install new modules. It’s used from the OS command line (Command Prompt window in Windows), not the Python prompt.

On Windows it’s recommended that you run the pip module instead via the Python launcher:

C:\>py -m pip install regex

Thank you Matthew, you deserve Nobel Prize in Python :wink:


C:\Users\a>py -m pip install regex
Defaulting to user installation because normal site-packages is not writeable
Collecting regex
Downloading regex-2022.10.31-cp38-cp38-win32.whl (255 kB)
|████████████████████████████████| 255 kB 79 kB/s
Installing collected packages: regex
Successfully installed regex-2022.10.31
WARNING: You are using pip version 20.2.3; however, version 23.0.1 is available.

You should consider upgrading via the ‘C:\Program Files\Python38-32\python.exe -
m pip install --upgrade pip’ command.

C:\Users\a>

thank you

darius

Tried to upgrade pip, as suggested above, but still no chance ;(

C:\Program Files>cd Python38-32

C:\Program Files\Python38-32>python.exe -m pip install -upgrade pip

Usage:
C:\Program Files\Python38-32\python.exe -m pip install [options] [package-index-options] …
C:\Program Files\Python38-32\python.exe -m pip install [options] -r [package-index-options] …
C:\Program Files\Python38-32\python.exe -m pip install [options] [-e] …
C:\Program Files\Python38-32\python.exe -m pip install [options] [-e] …
C:\Program Files\Python38-32\python.exe -m pip install [options] <archive url/
path> …

no such option: -u

C:\Program Files\Python38-32>

got help finally to work:

‘’’

help()

Welcome to Python 3.8’s help utility!

If this is your first time using Python, you should definitely check out
the tutorial on the Internet at The Python Tutorial — Python 3.8.17 documentation.

Enter the name of any module, keyword, or topic to get help on writing
Python programs and using Python modules. To quit this help utility and
return to the interpreter, just type “quit”.

To get a list of available modules, keywords, symbols, or topics, type
“modules”, “keywords”, “symbols”, or “topics”. Each module also comes
with a one-line summary of what it does; to list the modules whose name
or summary contain a given string such as “spam”, type “modules spam”.

help> “modules”

Please wait a moment while I gather a list of all available modules…

C:\Program Files\Python38-32\lib\site-packages\setuptools\distutils_patch.py:25:
UserWarning: Distutils was imported before Setuptools. This usage is discourage
d and may exhibit undesirable behaviors or errors. Please use Setuptools’ object
s directly or at least import Setuptools first.
warnings.warn(
future _threading_local getopt runpy
_abc _tkinter getpass sched
_ast _tracemalloc gettext secrets
_asyncio _warnings glob select
_bisect _weakref gzip selectors
_blake2 _weakrefset hashlib setuptools
_bootlocale _winapi heapq shelve
_bz2 _xxsubinterpreters hmac shlex
_codecs abc html shutil
_codecs_cn aifc http signal
_codecs_hk antigravity idlelib site
_codecs_iso2022 argparse imaplib smtpd
_codecs_jp array imghdr smtplib
_codecs_kr ast imp sndhdr
_codecs_tw asynchat importlib socket
_collections asyncio inspect socketserver
_collections_abc asyncore io sqlite3
_compat_pickle atexit ipaddress sre_compile
_compression audioop itertools sre_constants
_contextvars base64 json sre_parse
_csv bdb keyword ssl
_ctypes binascii lib2to3 stat
_ctypes_test binhex linecache statistics
_datetime bisect locale string
_decimal builtins logging stringprep
_dummy_thread bz2 lzma struct
_elementtree cProfile mailbox subprocess
_functools calendar mailcap sunau
_hashlib cgi marshal symbol
_heapq cgitb math symtable
_imp chunk mimetypes sys
_io cmath mmap sysconfig
_json cmd modulefinder tabnanny
_locale code msilib tarfile
_lsprof codecs msvcrt telnetlib
_lzma codeop multiprocessing tempfile
_markupbase collections netrc test
_md5 colorsys nntplib textwrap
_msi compileall nt this
_multibytecodec concurrent ntpath threading
_multiprocessing configparser nturl2path time
_opcode contextlib numbers timeit
_operator contextvars opcode tkinter
_osx_support copy operator token
_overlapped copyreg optparse tokenize
_pickle crypt os trace
_py_abc csv parser traceback
_pydecimal ctypes pathlib tracemalloc
_pyio curses pdb tty
_queue dataclasses pickle turtle
_random datetime pickletools turtledemo
_sha1 dbm pip types
_sha256 decimal pipes typing
_sha3 difflib pkg_resources unicodedata
_sha512 dis pkgutil unittest
_signal distutils platform urllib
_sitebuiltins doctest plistlib uu
_socket dummy_threading poplib uuid
_sqlite3 easy_install posixpath venv
_sre email pprint warnings
_ssl encodings profile wave
_stat ensurepip pstats weakref
_statistics enum pty webbrowser
_string errno py_compile winreg
_strptime faulthandler pyclbr winsound
_struct filecmp pydoc wsgiref
_symtable fileinput pydoc_data xdrlib
_testbuffer fnmatch pyexpat xml
_testcapi formatter queue xmlrpc
_testconsole fractions quopri xxsubtype
_testimportmultiple ftplib random zipapp
_testinternalcapi functools re zipfile
_testmultiphase gc reprlib zipimport
_thread genericpath rlcompleter zlib

Enter any module name to get more help. Or, type “modules spam” to search
for modules whose name or summary contain the string “spam”.

help>

‘’’
unfortunately
help(dir)

not supported


‘’’
help> help(dir)
No Python documentation found for ‘help(dir)’.
Use help() to get the interactive help utility.
Use help(str) for help on the str class.
‘’’

‘’’

help(dir)
The name ‘more’ is not recognized as an internal or external command,
executable program or batch file.
‘’’


Could you kindly explain me, why help(dir) worked for you
and failed to work for me ?>

what’s wrong ?

darius

It’s --upgrade (“long” options are prefixed by two hyphens, not just
one).

thank you
you did it :wink:

‘’’
C:\Program Files\Python38-32>python.exe -m pip install --upgrade pip
Defaulting to user installation because normal site-packages is not writeable
Collecting pip
Downloading pip-23.0.1-py3-none-any.whl (2.1 MB)
|████████████████████████████████| 2.1 MB 73 kB/s
Installing collected packages: pip
WARNING: The scripts pip.exe, pip3.8.exe and pip3.exe are installed in ‘C:\Use
rs\a\AppData\Roaming\Python\Python38\Scripts’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warn
ing, use --no-warn-script-location.
Successfully installed pip-23.0.1

C:\Program Files\Python38-32>

‘’’

Thank you Matthew

dir()
started to work, as described by you

but how to read full manual on dir() ?


‘’’

dir()
[‘annotations’, ‘builtins’, ‘doc’, ‘loader’, ‘name’, ‘pack
age
’, ‘spec’, ‘a’, ‘adj’, ‘b’, ‘cos’, ‘fruits’, ‘math’, ‘sin’, ‘sqrt’, ‘th
isdict’, ‘x’, ‘y’]
dir a
File “”, line 1
dir a
^
SyntaxError: invalid syntax
dir(‘a’)
[‘add’, ‘class’, ‘contains’, ‘delattr’, ‘dir’, ‘doc’, ‘_
eq_’, ‘format’, ‘ge’, ‘getattribute’, ‘getitem’, ‘__getnewargs
‘, ‘gt’, ‘hash’, ‘init’, ‘init_subclass’, ‘iter’, ‘le
, ‘len’, ‘lt’, ‘mod’, ‘mul’, ‘ne’, ‘new’, ‘reduce’,
reduce_ex’, ‘repr’, ‘rmod’, ‘rmul’, ‘setattr’, ‘sizeof
, ‘str’, ‘subclasshook’, ‘capitalize’, ‘casefold’, ‘center’, ‘count’, ‘e
ncode’, ‘endswith’, ‘expandtabs’, ‘find’, ‘format’, ‘format_map’, ‘index’, ‘isal
num’, ‘isalpha’, ‘isascii’, ‘isdecimal’, ‘isdigit’, ‘isidentifier’, ‘islower’, ’
isnumeric’, ‘isprintable’, ‘isspace’, ‘istitle’, ‘isupper’, ‘join’, ‘ljust’, ‘lo
wer’, ‘lstrip’, ‘maketrans’, ‘partition’, ‘replace’, ‘rfind’, ‘rindex’, ‘rjust’,
‘rpartition’, ‘rsplit’, ‘rstrip’, ‘split’, ‘splitlines’, ‘startswith’, ‘strip’,
‘swapcase’, ‘title’, ‘translate’, ‘upper’, ‘zfill’]
dir(‘fruits’)
[‘add’, ‘class’, ‘contains’, ‘delattr’, ‘dir’, ‘doc’, ’

eq
’, ‘format’, ‘ge’, ‘getattribute’, ‘getitem’, ‘__getnewargs
__’, ‘gt’, ‘hash’, ‘init’, ‘init_subclass’, ‘iter’, ‘le
, ‘len’, ‘lt’, ‘mod’, ‘mul’, ‘ne’, ‘new’, ‘reduce’,
reduce_ex’, ‘repr’, ‘rmod’, ‘rmul’, ‘setattr’, ‘sizeof
, ‘str’, ‘subclasshook’, ‘capitalize’, ‘casefold’, ‘center’, ‘count’, ‘e
ncode’, ‘endswith’, ‘expandtabs’, ‘find’, ‘format’, ‘format_map’, ‘index’, ‘isal
num’, ‘isalpha’, ‘isascii’, ‘isdecimal’, ‘isdigit’, ‘isidentifier’, ‘islower’, ’
isnumeric’, ‘isprintable’, ‘isspace’, ‘istitle’, ‘isupper’, ‘join’, ‘ljust’, ‘lo
wer’, ‘lstrip’, ‘maketrans’, ‘partition’, ‘replace’, ‘rfind’, ‘rindex’, ‘rjust’,
‘rpartition’, ‘rsplit’, ‘rstrip’, ‘split’, ‘splitlines’, ‘startswith’, ‘strip’,
‘swapcase’, ‘title’, ‘translate’, ‘upper’, ‘zfill’]

‘’’

You could read the documentation for python and its library.
Here for example is the documentation for dir(): Built-in Functions — Python 3.12.1 documentation

This is the entry to the documentation: 3.12.1 Documentation

Oh and the documentation for older versions is also online.

You wrote:

python.exe -m pip install -upgrade pip

with 1 hyphen but you should’ve written:

python.exe -m pip install --upgrade pip

with 2 hyphens.

You wouldn’t read the documentation with dir(), but with help(). dir() lists the currently-defined names.

As Barry said, there’s documentation online, but check that you’re looking at the correct version of Python.

There should also be documentation in a subfolder of the Python folder, which I believe will be C:\Program Files\Python38-32\Doc, judging from what you’ve posted.

That shouldn’t happen. This looks like a bug.

Please tell us:

  1. Your operating system.
  2. The version of Python you are running.

We may have more questions after you have answered.

To anyone else reading this: help() should select from three or four different “pager” programs, including more or less, depending on what OS is running and what capabilities are available. It shouldn’t just fail like that.

Hello Steven,

‘’’
Python 3.8.7 (tags/v3.8.7:6503f05, Dec 21 2020, 17:43:54) [MSC v.1928 32 bit (In
tel)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.

help(dir)
The name ‘more’ is not recognized as an internal or external command,
executable program or batch file.

‘’’
Windows 7

That’s odd. more is a Windows 7 command.

What happens if you type more at the Windows command prompt?

  • Open cmd.exe from the Start Menu
  • type dir | more
  • press Enter

It’s recommended on other platforms too, in that it is better to use:

 python3 -m pip install regex

where python3 is whatever Python executable you’re using. This is
because that ensures that pip installs appropriately for that
executable, avoiding the risk that the pip command itself is
associated with a different Python install and thus installs elsewhere.

Cheers,
Cameron Simpson cs@cskk.id.au

‘’’
C:\Users\a>dir | more
The name ‘more’ is not recognized as an internal or external command,
executable program or a batch file.

C:\Users\a>
‘’’

You have a broken Windows installation. more is a standard command line tool on Windows, if it is not there, something is wrong.

You need to talk to your system administrator, or other Windows experts, and see what they can suggest.

I operate old, private PC, so no outdoor admin,
but

more.com works fine

maybe I need to edit PATH, as suggested in

thank you

darius

What does set PATH report?