-
Notifications
You must be signed in to change notification settings - Fork 0
Modules
jasper-zanjani edited this page Aug 30, 2020
·
1 revision
When learning unfamiliar packages and importing them in a demonstration script, care must be taken that the demonstration script does not have the same name as the package being studied. If so, attempting to import the package while in an interpreter within that directory will cause the interpreter to try importing the incomplete script and not the package.
When running a Python interpreter within this directory, the files "calc" and "main" can be imported as modules by specifying their names with no file extension.
.
├── calc.py
└── main.py
import calc # No errors
import main # No errorsSpecifying the full filename including extension does produce an error
import calc.py # Error
import main.py # Error- argparse ?
- array ?
- asyncio ?
- bisect ?
- csv ?
- ctypes ?
- curses ?
- datetime ?
- functools ?
- getpass ?
- glob ?
- heapq ?
- http ?
- json ?
- logging ?
- optparse ?
- os ?
- pathlib ?
- platform ?
- pythonnet ?
- random ?
- socket ?
- subprocess ?
- sqlite3 ?
- sys ?
- termcolor ?
- threading ?
- trace ?
- typing ?
- unittest ?
- urllib ?
- venv ?
- weakref ?
- winrm ?