Git Product home page Git Product logo

Comments (6)

SASUPERNOVA avatar SASUPERNOVA commented on May 6, 2024 1

@Cephir23 That may be because you have already used the bugged version of gif-for-cli. When gif-for-cli reads a GIF, it creates a cache directory for the image where it places a config.json, which contains num_frames. Once that config is created, it will remain the same on each execution, so num_frames should still be 0, causing a divide by zero error. On my system (probably yours as well since you use Arch), the cache directory is ~/.cache/gif-for-cli/1.1.2. If there are any directories in the cache, try removing them and rerunning gif-for-cli.

from gif-for-cli.

Cephir23 avatar Cephir23 commented on May 6, 2024 1

@Cephir23 That may be because you have already used the bugged version of gif-for-cli. When gif-for-cli reads a GIF, it creates a cache directory for the image where it places a config.json, which contains num_frames. Once that config is created, it will remain the same on each execution, so num_frames should still be 0, causing a divide by zero error. On my system (probably yours as well since you use Arch), the cache directory is ~/.cache/gif-for-cli/1.1.2. If there are any directories in the cache, try removing them and rerunning gif-for-cli.

Worked! Thank you so much.

from gif-for-cli.

FrancoCorleone avatar FrancoCorleone commented on May 6, 2024

I have exactly the same problem, any workarounds?

from gif-for-cli.

SASUPERNOVA avatar SASUPERNOVA commented on May 6, 2024

@FrancoCorleone You could manually edit gif_for_cli/generate/__init__.py to add my fixes Add missing "rows" option in _save_config and Add fallback regex method to _run_ffmpeg. If you are on arch, the files should be in ~/.local/lib/python3.11/site-packages/gif_for_cli-1.1.2-py3.11.egg/. If not, check the path in your error message.

Edit: If you don't feel like manually editing, you could also replace gif_for_cli/generate/__init__.py with the one from my repo.

from gif-for-cli.

Cephir23 avatar Cephir23 commented on May 6, 2024

Same issue here.

[cephir@archlinux]$ gif-for-cli
Traceback (most recent call last):
File "/home/cephir/.local/bin/gif-for-cli", line 8, in
sys.exit(main())
^^^^^^
File "/home/cephir/.local/lib/python3.11/site-packages/gif_for_cli/main.py", line 23, in main
execute(os.environ, sys.argv[1:], sys.stdout)
File "/home/cephir/.local/lib/python3.11/site-packages/gif_for_cli/execute.py", line 94, in execute
seconds_per_frame=config['seconds'] / config['num_frames'],
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
ZeroDivisionError: float division by zero

I tried replacing gif_for_cli/generate/init.py with the one from your repo, but it doesn't work for me.

from gif-for-cli.

Lepidos avatar Lepidos commented on May 6, 2024

num_fames is on: gif_for_cli/generate/init.py

just replace it

  • num_frames = int(re.search(r'frame=\s*(\d+)', err).group(1))
  • num_frames = len(glob.glob1('{}/'.format(output_dirnames['jpg']),"*.jpg"))

https://github.com/Lepidos/gif-for-cli/blob/master/gif_for_cli/generate/__init__.py

from gif-for-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.