Skip to content

Error in render_frame, mac related? #474

Description

@ivanlen

Describe the bug
I get a java error when I try to render a frame.

To Reproduce
Either running a python script or using the notebook extension

import py5
import numpy as np

canvas_size = 1000
pad = 10

points = pad / 2 + np.random.random((100, 2)) * (canvas_size - pad)


def draw(s: py5.Sketch):
    py5.background(255)
    py5.stroke(0)
    # set width of line
    py5.stroke_weight(1)
    for i in range(len(points) - 1):
        py5.line(points[i][0], points[i][1], points[i + 1][0], points[i + 1][1])

img = py5.render_frame(draw, canvas_size, canvas_size)

I get this error

py5 encountered an error in your code:

File "PSurfaceNone.java", line 356, in processing.core.PSurfaceNone$AnimationThread.run

Exception: Java Exception

The above exception was the direct cause of the following exception:

java.lang.NullPointerException: java.lang.NullPointerException: Cannot invoke "processing.core.PGraphics.background(int)" because "this.g" is null

Expected behavior
No error

System information:

  • p5==0.8.4
  • Python 3.11.0
  • Operating system: MacOs 14.6.1 (23G93)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions