cancel
Showing results for 
Search instead for 
Did you mean: 

Blender Discussions

irz
Adept II

What's the hell... division by zero! Couldn't render!

Mac os 10.15.3

RPR 2.2.12

RX 5700 XT

Blender 2.82 (beta)

When I press start render image I have this kind if Error: ZeroDivisionError: division by zero

I can't give you me blender file because of copyright. But I show you console:

---------

Start Render

/Volumes/....../

0

2020-02-09 10:25:39,831 ERROR rpr.init [123145400025088]:  division by zero EXCEPTION: Traceback (most recent call last):

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/__init__.py", line 86, in update

    self.engine.sync(depsgraph)

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/engine/render_engine.py", line 389, in sync

    self.world_backplate = world.Backplate(scene.world.rpr, (self.width, self.height))

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/export/world.py", line 109, in __init__

    world_data.background_image, render_size

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/export/world.py", line 161, in get_cropped_image

    render_size[0], render_size[1],

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/export/world.py", line 115, in calculate_cropped_size

    ratio_image = x1 / y1

ZeroDivisionError: division by zero

2020-02-09 10:25:39,831 - rpr.init - ERROR - division by zero EXCEPTION: Traceback (most recent call last):

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/__init__.py", line 86, in update

    self.engine.sync(depsgraph)

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/engine/render_engine.py", line 389, in sync

    self.world_backplate = world.Backplate(scene.world.rpr, (self.width, self.height))

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/export/world.py", line 109, in __init__

    world_data.background_image, render_size

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/export/world.py", line 161, in get_cropped_image

    render_size[0], render_size[1],

  File "/Users/.../Library/Application Support/Blender/2.82/scripts/addons/rprblender/export/world.py", line 115, in calculate_cropped_size

    ratio_image = x1 / y1

ZeroDivisionError: division by zero

----

There all my output settings are correct. I was able to render this scene last night. And after come to this scene without any changes I couldn't render because this ERROR!

Your RPR is stay in deep alpha stage. Absolutely not usable.

0 Likes
2 Replies
irz
Adept II

Ok, It seem I found the problem. There RPR couldn't forget patch link to Background override file while this option was uncheck!

I uncheck "Background override" while this error stay. It was need to force delete link to file even option was uncheck.

You should put some more checking error options to your code.

0 Likes
warnerjonn
Journeyman III

The super class of ZeroDivisionError is ArithmeticError. This exception raised when the second argument of a division or modulo operation is zero. In Mathematics, when a number is divided by a zero, the result is an infinite number. It is impossible to write an Infinite number physically. Python interpreter throws “ZeroDivisionError” error if the result is infinite number. While implementing any program logic and there is division operation make sure always handle ArithmeticError or ZeroDivisionError so that program will not terminate.

try:

z = x / y
except ZeroDivisionError:
z = 0

Or check before you do the division:

if y == 0:
z = 0
else:
z = x / y

The latter can be reduced to:

z = 0 if y == 0 else (x / y)

 

0 Likes