Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of extra output to console when running example from docs. #333

Closed
stuaxo opened this issue Jan 10, 2022 · 4 comments
Closed

Lots of extra output to console when running example from docs. #333

stuaxo opened this issue Jan 10, 2022 · 4 comments

Comments

@stuaxo
Copy link

stuaxo commented Jan 10, 2022

I ran the following example on Ubuntu 21.04 in a virtualenv [1] from the docs (minor changes, I made y global to stop it complaining and added no_loop so it runs once), and there is a lot of console output [2]

[1] bot program

from p5 import *

# The statement in setup() function
# ececute once when the program begins
def setup():
    global y
    size(640, 360) # size must be the first statement
    stroke(255) # Set line drawing color to white
    y = 0

# The statements in draw() are executed until the
# program is stopped. Each statement is executed in
# sequence and after the last line is read, the first
# line is executed again.
def draw():
    global y
    background(0) # Clear the screen with a black background
    y = y - 1
    if y < 0:
            y = height

    line((0, y), (width, y))
    
    no_loop()
    print()


if __name__ == '__main__':
    run()

[2] console output

WARNING: Traceback (most recent call last):
  File "/home/stu/projects/work/dit/firebreak/data-vis-scratch/p5test.py", line 29, in <module>
    run()
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/p5/sketch/userspace.py", line 155, in run
    p5.sketch = Sketch(setup_method, draw_method, handlers, frame_rate)
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/p5/sketch/base.py", line 60, in __init__
    app.Canvas.__init__(
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/app/canvas.py", line 211, in __init__
    self.create_native()
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/app/canvas.py", line 228, in create_native
    self._app.backend_module.CanvasBackend(self, **self._backend_kwargs)
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/app/backends/_glfw.py", line 298, in __init__
    self._on_resize(self._id, size[0], size[1])
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/app/backends/_glfw.py", line 394, in _on_resize
    self._vispy_canvas.events.resize(
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/util/event.py", line 453, in __call__
    self._invoke_callback(cb, event)
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/util/event.py", line 471, in _invoke_callback
    _handle_exception(self.ignore_callback_errors,
  << caught exception here: >>
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/util/event.py", line 469, in _invoke_callback
    cb(event)
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/p5/sketch/base.py", line 157, in on_resize
    p5.renderer.reset_view()
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/p5/sketch/renderer2d.py", line 82, in reset_view
    self.texture_prog['modelview'] = self.modelview_matrix.T.flatten()
TypeError: 'NoneType' object does not support item assignment
ERROR: Invoking <bound method Sketch.on_resize of <Sketch (Glfw) at 0x7f0abd37f310>> for ResizeEvent

Exception ignored on calling ctypes callback function: <function CanvasBackend._on_close at 0x7f0abd392dc0>
Traceback (most recent call last):
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/glfw/__init__.py", line 660, in callback_wrapper
    return func(*args, **kwargs)
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/app/backends/_glfw.py", line 400, in _on_close
    self._vispy_canvas.close()
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/app/canvas.py", line 463, in close
    self.events.close()
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/util/event.py", line 453, in __call__
    self._invoke_callback(cb, event)
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/vispy/util/event.py", line 469, in _invoke_callback
    cb(event)
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/p5/sketch/base.py", line 148, in on_close
    exit()
  File "/usr/lib/python3.9/_sitebuiltins.py", line 26, in __call__
    raise SystemExit(code)
SystemExit: None
Traceback (most recent call last):
  File "/home/stu/projects/work/dit/firebreak/data-vis-scratch/p5test.py", line 29, in <module>
    run()
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/p5/sketch/userspace.py", line 167, in run
    exit()
  File "/home/stu/.virtualenvs/firebreakdatavis/lib/python3.9/site-packages/p5/sketch/userspace.py", line 250, in exit
    p5.exit(*args, **kwargs)
AttributeError: module 'p5.core.p5' has no attribute 'exit'
@github-actions
Copy link
Contributor

Thank you for submitting your first issue to p5py

@talledodiego
Copy link

I have the same issue. Nevertheless the program seems to work just fine.

@stuaxo
Copy link
Author

stuaxo commented Feb 23, 2022

@talledodiego nice! I just gave up and assumed I hadn't got things installed properly.

@tushar5526
Copy link
Member

Closing as this was fixed in #346

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants