Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ZeroDivisionError
#1
I am working on somebody's GitHub project and trying to run it produces this. I changed the time_delta = 1./fps to time_delta == 1./fps but I only got NameError: name 'time_delta' is not defined. I cannot figure out why fps == 0 for sure, but I think it is because the script cannot find the frames per second for the video. You can see what I mean here. I guess to reproduce this issue you need to install it and then use video-to-ascii -f {file}.mp4. It gives me this error because it cannot find the FPS of the video.

I would appreciate any help I can get, so that I can make a pull request to fix this issue.

Thanks in advance :) (and sorry for my horrible formatting)

Error:
video-to-ascii -f retail.mp4 Traceback (most recent call last): File "/home/mycatcondo3028/.local/bin/video-to-ascii", line 10, in <module> sys.exit(main()) File "/home/mycatcondo3028/.local/lib/python3.7/site-packages/video_to_ascii/cli.py", line 21, in main player.play(ARGS.file, strategy=ARGS.strategy, output=ARGS.output, play_audio=ARGS.with_audio) File "/home/mycatcondo3028/.local/lib/python3.7/site-packages/video_to_ascii/player.py", line 23, in play engine.play(output) File "/home/mycatcondo3028/.local/lib/python3.7/site-packages/video_to_ascii/video_engine.py", line 38, in play with_audio=self.with_audio) File "/home/mycatcondo3028/.local/lib/python3.7/site- packages/video_to_ascii/render_strategy/ascii_strategy.py", line 113, in render time_delta = 1./fps ZeroDivisionError: float division by zero
I don't know what to do, because whatever I do still produces this error.

Here is the part of the code by the way:
if output is not None:
           file = open(output, 'w+')
           file.write("#!/bin/bash \n")
           file.write("echo -en '\033[2J' \n")
           file.write("echo -en '\u001b[0;0H' \n")

       time_delta = 1./fps
       counter=0
       sys.stdout.write("echo -en '\033[2J' \n")
       # read each frame
buran write Nov-18-2020, 11:55 AM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Reply


Messages In This Thread
ZeroDivisionError - by MyCatCondo - Nov-17-2020, 08:32 PM
RE: ZeroDivisionError - by GOTO10 - Nov-17-2020, 09:33 PM
RE: ZeroDivisionError - by MyCatCondo - Nov-17-2020, 10:51 PM
RE: ZeroDivisionError - by GOTO10 - Nov-19-2020, 02:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020