Skip to content

DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious #305

Closed

Description

@Zian

Python 3.13.7 displays the following message after line 8 of the below script that uses the progressbar module.

DeprecationWarning: Parsing dates involving a day of month without a year specified is ambiguious and fails to parse leap day. The default behavior will change in Python 3.15 to either always raise an exception or to use a different default year (TBD).
To avoid trouble, add a specific year to the input & format.
See python/cpython#70647.

Script

import time
import progressbar

SLEEP_DURATION_IN_SECONDS = 3

example_list = [1, 2, 3]
completed_items = 0
with progressbar.ProgressBar(max_value=len(example_list)) as prg:
	time.sleep(SLEEP_DURATION_IN_SECONDS)
	completed_items = completed_items + 1
	prg.update(completed_items)

Steps to Reproduce the Bug

  1. Install Python 3.13.7.
  2. Install the progressbar module
  3. Run the aforementioned script.

Environmental Details

  • Microsoft Windows Version 22H2 (OS Build 19045.6937)
  • Python 3.13.7 ("Python 3.13.7 | packaged by Anaconda, Inc. | (main, Sep 11 2025, 16:13:29) [MSC v.1938 64 bit (AMD64)] on win32")
  • progressbar2 Version 4.5.0

Activity

  1. reopened this on Apr 17, 2026
  2. Zian commented on Sep 8, 2026

    @Zian
    Author

    The bug is still present in version 4.6.0 of the progressbar2 module. I verified that I was using version 4.6.0 by running the following Python code:
    import progressbar
    print(progressbar.__version__)

    It printed:

    4.6.0

  3. wolph commented on Sep 8, 2026

    @wolph
    Owner

    Thanks for checking the version and reporting back, @Zian! You're right: updating progressbar2 alone doesn't resolve this. The previous fix addressed a different warning in the test setup. Sorry for the confusion!

    The same warning is reproducible with progressbar2 4.6.0 and Python 3.13.7 on macOS when older Jupyter packages are installed. When progressbar detects the terminal width, its python-utils dependency checks for notebook support. That check imports ipykernel, even when you're running an ordinary script.

    Older versions of ipykernel and jupyter_client call datetime.strptime("1", "%d") during import. Python 3.13 warns because that parses a day of the month without a year. That's why the warning appears when you create the progress bar.

    Since you're using Anaconda, activate the environment where you run the script, then update both packages:

    conda install "ipykernel>=6.30.0" "jupyter_client>=8.6.3"

    Those minimum versions include the upstream fixes in ipykernel and jupyter_client. With ipykernel 6.30.0 and jupyter_client 8.6.3, the reproduced warning disappears while keeping progressbar2 at 4.6.0. Restart your Python session or notebook kernel after updating, then try your script again.

    If you can't update those packages yet, adding term_width=80 to your existing ProgressBar(...) call also avoids the warning in the reproduction. That skips automatic terminal-width detection and keeps the bar at 80 columns, so it won't adapt when you resize the terminal.

    If the warning persists after updating and restarting Python, please share your installed ipykernel and jupyter_client versions and the full warning output. That will help check whether another dependency is triggering it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions