Fedora 35, Python 3.10.2, Thonny 3.3.14
Installed py5
Installed thonny-py5mode
Program arguments: imported_mode
Small demo program:
def setup():
size(500, 500)
fill(255, 0, 0)
no_stroke()
def draw():
circle(mouse_x, mouse_y, 10)
print(frame_count)
Click on Run current script (F5)
ERROR thonny.backend: PROBLEM WITH THONNY'S BACK-END
Traceback (most recent call last):
File "/usr/lib/python3.10/site-packages/thonny/plugins/cpython/cpython_backend.py", line 228, in _handle_normal_command
response = handler(cmd)
File "/usr/lib/python3.10/site-packages/thonny/plugins/cpython/cpython_backend.py", line 404, in _cmd_Run
return self._execute_file(cmd, SimpleRunner)
File "/usr/lib/python3.10/site-packages/thonny/plugins/cpython/cpython_backend.py", line 845, in _execute_file
with tokenize.open(full_filename) as fp:
File "/usr/lib64/python3.10/tokenize.py", line 394, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/usr/lib64/python3.10/site-packages/py5_tools/tools/run_sketch.py'
My Python 3.10.2 site-packages are not where Thonny looks for them.
I can fix this with modifying running.py:
####### insert this new code
if args and args[0] == 'imported_mode':
import site
rs_file = '/py5_tools/tools/run_sketch.py'
#rs_path = str(site.getsitepackages()[0]) + rs_file
rs_path = "/usr/local/lib/python3.10/site-packages" + rs_file
cmd_parts = ["%" + command_name, rs_path, rel_filename]
####### insert end
Don't think this is the right way to fix this.
Thanks,
lujo