Tuesday, March 31, 2026

Python Distribution Error (TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero')

 Last year I cut my teeth at creating a Python package; Dividere


Recently, building the package was encountering an error:

 

 

python3 setup.py sdist bdist_wheel
running sdist
running egg_info
creating dividere.egg-info
writing dividere.egg-info/PKG-INFO
writing dependency_links to dividere.egg-info/dependency_links.txt
writing requirements to dividere.egg-info/requires.txt
writing top-level names to dividere.egg-info/top_level.txt
writing manifest file 'dividere.egg-info/SOURCES.txt'
reading manifest file 'dividere.egg-info/SOURCES.txt'
adding license file 'LICENSE'
Traceback (most recent call last):
  File "/home/lipeltgm/dividere/setup.py", line 15, in 
    setup(
  File "/usr/local/lib/python3.10/dist-packages/setuptools/__init__.py", line 117, in setup
    return distutils.core.setup(**attrs)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 186, in setup
    return run_commands(dist)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/core.py", line 202, in run_commands
    dist.run_commands()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 983, in run_commands
    self.run_command(cmd)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 999, in run_command
    super().run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 1002, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/sdist.py", line 59, in run
    self.run_command('egg_info')
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/cmd.py", line 339, in run_command
    self.distribution.run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/dist.py", line 999, in run_command
    super().run_command(command)
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/dist.py", line 1002, in run_command
    cmd_obj.run()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/egg_info.py", line 312, in run
    self.find_sources()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/egg_info.py", line 320, in find_sources
    mm.run()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/egg_info.py", line 548, in run
    self.prune_file_list()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/command/sdist.py", line 162, in prune_file_list
    super().prune_file_list()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_distutils/command/sdist.py", line 380, in prune_file_list
    base_dir = self.distribution.get_fullname()
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 272, in get_fullname
    return _distribution_fullname(self.get_name(), self.get_version())
  File "/usr/local/lib/python3.10/dist-packages/setuptools/_core_metadata.py", line 290, in _distribution_fullname
    canonicalize_version(version, strip_trailing_zero=False),
TypeError: canonicalize_version() got an unexpected keyword argument 'strip_trailing_zero'
make: *** [Makefile:26: buildPipPackage] Error 1

Apparently, there was an error introduced in a recent version of setuptools.  A work-around is to downgrade to an older version to temporarily resolve the issue.

 

~/dividere$ sudo pip3 install setuptools==70.0
 

 

 

 

 

Tuesday, March 24, 2026

Extending Video Introduction

 Sometimes it's useful to slow, or extend the introduction of a video.  For example, suppose you're utilizing a slow video transition (like a fade out/in effect) but don't want to miss the beginning frames of the second video.  By extracting the first frame of the video, elongating it to X seconds we can preserve the transition effect without losing video content.


Let's take a peek at how to accomplish this;


$ cat -n Makefile
     1    all: postVideo.mp4
     2   
     3    video.mp4: BigBuckBunny.mp4
     4        ${SH} ffmpeg -i $< -codec copy -strict -2 -t 10 $@
     5   
     6    image.jpg: video.mp4
     7        ${SH} ffmpeg -i $< -vf "select=eq(n\,0)" -q:v 3 $@
     8        ${SH} display $@
     9   
    10    preVid.mp4: image.jpg
    11        ${SH} ffmpeg -loop 1 -i $< -f lavfi -i aevalsrc=0 -t 3 $@
    12   
    13    postVideo.mp4: preVid.mp4 video.mp4
    14    #    ${SH} ffmpeg -i preVid.mp4 -i video.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [vv] [aa]" -map "[vv]" -map "[aa]" $@
    15        ${SH} ffmpeg -i preVid.mp4 -i video.mp4 -filter_complex "[0:v] [0:a] [1:v] [1:a] concat=n=2:v=1:a=1 [vo] [ao]" -map "[vo]" -map "[ao]" $@
    16   
    17    clean:
    18        ${RM} *.jpg
    19        ${SH} find . -name "*.mp4" -not -name "BigBuckBunny.mp4" -delete

The input video (video.mp4) is generated by grabbing the first 10 seconds of BigBuckBunny.mp4; refer lines 3-4

Then, the first frame of the input video (video.mp4) is extracted and saved as image.jpg (ref lines 6-8)

Then, a new introduction video clip is generated by converting the image into a video clip of X seconds; ref lines 10-11).  Note, a null audio track is created to preserve the audio in the outgoing video.

Lastly, a new video is created by concatenating the intro clip with the original clip, the result as a video with extended first frame. 

One other trick worth mentioning with this makefile, I frequently want a clean target to clobber any video files created along the way.  However, you don't want to delete the original source file, this can be accomplished by utilizing a find+not condition; ref line 19.  This proves useful for many projects.

And, just like that, you've got a video with an elongated intro.

Tuesday, March 17, 2026

Youtube-Dl Broke/Fixing

 'Some folks' use youtube-dl on a regular basis, to pull raw video and create new content.  Early in 2023 it appeared to stop working.  


$ youtube-dl https://www.youtube.com/watch?v=8QWjCzULyNA
[youtube] 8QWjCzULyNA: Downloading webpage
ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.


Forums seemed to imply the issue was known and a fix was in play, so I put my feet up and figured I'd check back in a few weeks.  A month, or two, goes by and reinstallation/retrying didn't seem to resolve.  So I revisited the fix posts and found it referenced a different package/utility so I tried that out.


$ sudo pip3 uninstall youtube-dl

$ sudo pip3 install yt-dlp


$ yt-dlp https://www.youtube.com/watch?v=8QWjCzULyNA

Hope this helps someone else.

Cheers