When calling calendar.month today, an error is reported. The
code is as follows
import calendar
yy=int(input("year:"))
mm=int(input("month:"))
print(calendar.month(yy,mm))
The error report is shown in the figure below
look at the yellow part circled in the figure. Circular import may be circular. You can see that the program file name is calendar.py, which is consistent with the introduced calendar, so it causes an error.
Solution
just modify the file name, which cannot have the same name as the imported package
Read More:
- [Solved] NPM install Error: check python checking for Python executable python2 in the PATH
- Invalid python sd, Fatal Python error: init_fs_encoding: failed to get the Python cod [How to Solve]
- How to Solve Python WARNING: Ignoring invalid distribution -ip (e:\python\python_dowmload\lib\site-packages)
- [Solved] opencv-python: recipe for target ‘modules/python3/CMakeFiles/opencv_python3.dir/all‘ failed
- Python Error: pip install mysql-connector-python failed
- Linux installs Python and upgrades Python
- [Solved] Python Error: tensorflow.python.framework.errors_impl.UnknownError: 2 root error(s) found.
- Opencv-python Install is Stuck Error: running setup.py bdist_wheel for opencv-python
- [Solved] supervisor Error: /usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2
- npm install Error: stack Error: Can’t find Python executable “python”
- Pychar can’t connect to Python console, but it can run. Py file, and Anaconda’s command line can run Python command
- [Solved] cv2.error: OpenCV(4.6.0) D:\a\opencv-python\opencv-python\opencv\modules\……
- An introduction to sys modules in Python and how packages are imported and used
- Python_Syntax error: unexpected character after line continuation character
- Python server run code ModuleNotFoundError Error [How to Solve]
- Full explanation of SYS module of Python
- [Solved] Python Project Import Module Error: ModuleNotFoundError
- Python: RNN principle realized by numpy
- Python ValueError: only 2 non-keyword arguments accepted