mu-editor / mu

A small, simple editor for beginner Python programmers. Written in Python and Qt5.
http://codewith.mu
GNU General Public License v3.0
1.41k stars 437 forks source link

Issues running p5 #2034

Open jeskdm opened 2 years ago

jeskdm commented 2 years ago

What were you trying to do?

Trying to run program using p5

What steps did you take to trigger the issue?

This is the following code I try to run:

from p5 import *

def setup():
    size(640, 360)
    no_stroke()
    background(204)

def draw():
    if mouse_is_pressed:
        fill(random_uniform(255), random_uniform(127), random_uniform(51), 127)
    else:
        fill(255, 15)

    circle_size = random_uniform(low=10, high=80)

    circle((mouse_x, mouse_y), circle_size)

def key_pressed(event):
    background(204)

run()

What did you expect to happen?

The code to run ok

What actually happened?

This is the logfile:

WARNING: Traceback (most recent call last): File "c:\users\jesyv\onedrive\skrivebord\processing i python.py", line 21, in run() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\p5\sketch\userspace.py", line 155, in run p5.sketch = Sketch(setup_method, draw_method, handlers, frame_rate) File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\p5\sketch\base.py", line 60, in init app.Canvas.init( File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app\canvas.py", line 211, in init self.create_native() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app\canvas.py", line 228, in create_native self._app.backend_module.CanvasBackend(self, **self._backend_kwargs) File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app\backends_glfw.py", line 298, in init self._on_resize(self._id, size[0], size[1]) File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app\backends_glfw.py", line 394, in _on_resize self._vispy_canvas.events.resize( File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\util\event.py", line 453, in call self._invoke_callback(cb, event) File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\util\event.py", line 471, in _invoke_callback _handle_exception(self.ignore_callback_errors, << caught exception here: >> File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\util\event.py", line 469, in _invoke_callback cb(event) File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\p5\sketch\base.py", line 157, in on_resize p5.renderer.reset_view() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\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 0x2b717034760>> for ResizeEvent Traceback (most recent call last): File "c:\users\jesyv\onedrive\skrivebord\processing i python.py", line 21, in run() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\p5\sketch\userspace.py", line 167, in run exit() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\p5\sketch\userspace.py", line 249, in exit app.quit()

File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app_default_app.py", line 66, in quit return default_app.quit() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app\application.py", line 172, in quit return self._backend._vispy_quit() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app\backends_glfw.py", line 197, in _vispy_quit win._vispy_canvas.close() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\app\canvas.py", line 463, in close self.events.close() File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\util\event.py", line 453, in call self._invoke_callback(cb, event) File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\vispy\util\event.py", line 469, in _invoke_callback cb(event) File "C:\Users\jesyv\AppData\Local\python\mu\mu_venv-38-20220212-180301\lib\site-packages\p5\sketch\base.py", line 148, in on_close exit() File "C:\Users\jesyv\AppData\Local\Programs\Mu Editor\Python\lib_sitebuiltins.py", line 26, in call raise SystemExit(code) SystemExit: None

---------- FINISHED ---------- exit code: 2 status: 0

Operating System Version

Windows 11

Mu Version

1.1.0b7

Other Info

No response

Editor Log

No response

carlosperate commented 2 years ago

Hi @jeskdm, thanks for the report!

Mu brings its own Python installation, have you installed the package inside Mu via the settings? https://codewith.mu/en/tutorials/1.1/pypi

jeskdm commented 2 years ago

Thank you for the reply. Yes I installed it inside mu.

carlosperate commented 2 years ago

Thanks for getting back to us! Okay, could you run the programme again and send us the log? https://codewith.mu/en/howto/1.1/read_logs

jeskdm commented 2 years ago

Here it is: 2022-02-24 11:08:08,940 - root:113(run) INFO:


Starting Mu 1.1.0.alpha.2 2022-02-24 11:08:08,943 - root:114(run) INFO: uname_result(system='Windows', node='LAPTOP-LNT2CURL', release='10', version='10.0.22000', machine='AMD64', processor='Intel64 Family 6 Model 142 Stepping 10, GenuineIntel') 2022-02-24 11:08:08,943 - root:115(run) INFO: Python path: ['C:\Program Files\Mu\pkgs', 'C:\Program Files\Mu', 'C:\Program Files\Mu\Python\python36.zip', 'C:\Program Files\Mu\Python\DLLs', 'C:\Program Files\Mu\Python\lib', 'C:\Program Files\Mu\Python', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages', 'C:\Program Files\Mu\pkgs\IPython\extensions'] 2022-02-24 11:08:08,943 - root:116(run) INFO: Language code: nb_NO 2022-02-24 11:08:09,193 - mu.logic:587(init) INFO: Setting up editor. 2022-02-24 11:08:09,194 - mu.logic:609(init) INFO: Settings path: C:\Users\jesyv\AppData\Local\python\mu\settings.json 2022-02-24 11:08:09,194 - mu.logic:610(init) INFO: Session path: C:\Users\jesyv\AppData\Local\python\mu\session.json 2022-02-24 11:08:09,194 - mu.logic:611(init) INFO: Log directory: C:\Users\jesyv\AppData\Local\python\mu\Logs 2022-02-24 11:08:09,194 - mu.logic:612(init) INFO: Data directory: C:\Users\jesyv\AppData\Local\python\mu 2022-02-24 11:08:09,223 - mu.logic:625(setup) INFO: Available modes: python, circuitpython, microbit, esp, web, debugger, pygamezero 2022-02-24 11:08:10,578 - mu.logic:1266(change_mode) INFO: Workspace directory: C:\Users\jesyv\mu_code 2022-02-24 11:08:10,578 - mu.logic:684(restore_session) INFO: Restoring session from: C:\Users\jesyv\AppData\Local\python\mu\session.json 2022-02-24 11:08:10,579 - mu.logic:685(restore_session) DEBUG: {'theme': 'day', 'mode': 'python', 'paths': ['C:\Users\jesyv\OneDrive\Skrivebord\summer.py', 'C:\Users\jesyv\OneDrive\Skrivebord\temp1.py'], 'envars': {}, 'minify': False, 'microbit_runtime': '', 'zoom_level': 6, 'window': {'x': -1921, 'y': -9, 'w': 1920, 'h': 1001}} 2022-02-24 11:08:10,579 - mu.logic:776(_load) INFO: Loading script from: C:\Users\jesyv\OneDrive\Skrivebord\summer.py 2022-02-24 11:08:10,579 - mu.logic:785(_load) INFO: The file C:\Users\jesyv\OneDrive\Skrivebord\summer.py does not exist. 2022-02-24 11:08:10,579 - mu.logic:776(_load) INFO: Loading script from: C:\Users\jesyv\OneDrive\Skrivebord\temp1.py 2022-02-24 11:08:10,579 - mu.logic:785(_load) INFO: The file C:\Users\jesyv\OneDrive\Skrivebord\temp1.py does not exist. 2022-02-24 11:08:10,579 - mu.logic:706(restore_session) INFO: Loaded files. 2022-02-24 11:08:10,579 - mu.logic:710(restore_session) INFO: User defined environment variables: {} 2022-02-24 11:08:10,579 - mu.logic:714(restore_session) INFO: Minify scripts on micro:bit? False 2022-02-24 11:08:10,633 - mu.logic:1266(change_mode) INFO: Workspace directory: C:\Users\jesyv\mu_code 2022-02-24 11:08:11,581 - mu.logic:742(restore_session) INFO: Starting with blank file. 2022-02-24 11:08:26,429 - mu.logic:1137(quit) DEBUG: Session: {'theme': 'day', 'mode': 'python', 'paths': [], 'envars': {}, 'minify': False, 'microbit_runtime': '', 'zoom_level': 6, 'window': {'x': -1929, 'y': -9, 'w': 1920, 'h': 1001}} 2022-02-24 11:08:26,429 - mu.logic:1138(quit) DEBUG: Saving session to: C:\Users\jesyv\AppData\Local\python\mu\session.json 2022-02-24 11:08:26,430 - mu.logic:1152(quit) INFO: Quitting.

2022-02-24 11:08:30,692 - root:113(run) INFO:


Starting Mu 1.1.0.alpha.2 2022-02-24 11:08:30,692 - root:114(run) INFO: uname_result(system='Windows', node='LAPTOP-LNT2CURL', release='10', version='10.0.22000', machine='AMD64', processor='Intel64 Family 6 Model 142 Stepping 10, GenuineIntel') 2022-02-24 11:08:30,692 - root:115(run) INFO: Python path: ['C:\Program Files\Mu\pkgs', 'C:\Program Files\Mu', 'C:\Program Files\Mu\Python\python36.zip', 'C:\Program Files\Mu\Python\DLLs', 'C:\Program Files\Mu\Python\lib', 'C:\Program Files\Mu\Python', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages', 'C:\Program Files\Mu\pkgs\IPython\extensions'] 2022-02-24 11:08:30,692 - root:116(run) INFO: Language code: nb_NO 2022-02-24 11:08:30,807 - mu.logic:587(init) INFO: Setting up editor. 2022-02-24 11:08:30,807 - mu.logic:609(init) INFO: Settings path: C:\Users\jesyv\AppData\Local\python\mu\settings.json 2022-02-24 11:08:30,807 - mu.logic:610(init) INFO: Session path: C:\Users\jesyv\AppData\Local\python\mu\session.json 2022-02-24 11:08:30,807 - mu.logic:611(init) INFO: Log directory: C:\Users\jesyv\AppData\Local\python\mu\Logs 2022-02-24 11:08:30,807 - mu.logic:612(init) INFO: Data directory: C:\Users\jesyv\AppData\Local\python\mu 2022-02-24 11:08:30,836 - mu.logic:625(setup) INFO: Available modes: python, circuitpython, microbit, esp, web, debugger, pygamezero 2022-02-24 11:08:31,631 - mu.logic:1266(change_mode) INFO: Workspace directory: C:\Users\jesyv\mu_code 2022-02-24 11:08:31,632 - mu.logic:684(restore_session) INFO: Restoring session from: C:\Users\jesyv\AppData\Local\python\mu\session.json 2022-02-24 11:08:31,632 - mu.logic:685(restore_session) DEBUG: {'theme': 'day', 'mode': 'python', 'paths': [], 'envars': {}, 'minify': False, 'microbit_runtime': '', 'zoom_level': 6, 'window': {'x': -1929, 'y': -9, 'w': 1920, 'h': 1001}} 2022-02-24 11:08:31,632 - mu.logic:706(restore_session) INFO: Loaded files. 2022-02-24 11:08:31,632 - mu.logic:710(restore_session) INFO: User defined environment variables: {} 2022-02-24 11:08:31,632 - mu.logic:714(restore_session) INFO: Minify scripts on micro:bit? False 2022-02-24 11:08:31,677 - mu.logic:1266(change_mode) INFO: Workspace directory: C:\Users\jesyv\mu_code 2022-02-24 11:08:32,388 - mu.logic:742(restore_session) INFO: Starting with blank file. 2022-02-24 11:09:36,723 - mu.logic:1161(show_admin) INFO: Showing admin with logs from C:\Users\jesyv\AppData\Local\python\mu\Logs\mu.log 2022-02-24 11:09:36,723 - mu.logic:163(installed_packages) INFO: Packages found: ['C:\Users\jesyv\AppData\Local\python\mu\site-packages\cycler-0.10.0.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\kiwisolver-1.3.1.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\matplotlib-3.3.3.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\mpmath-1.1.0-py3.6.egg-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\numpy-1.19.4.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\numpy-1.19.5.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\Pillow-8.0.1.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\pygal-3.0.0.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\pygame-1.9.6.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\pylab_sdk-1.3.2.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\pyparsing-2.4.7.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\PySimpleGUI-4.28.0.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\python_dateutil-2.8.1.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\scipy-1.5.4.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\six-1.15.0.dist-info', 'C:\Users\jesyv\AppData\Local\python\mu\site-packages\sympy-1.6.2.dist-info']

carlosperate commented 2 years ago

Hi @jeskdm,

Thank you for sending the log. Looking at it I do not see any errors, did you run the program that produced the error before getting the log?