ERROR thonny.backend: PROBLEM WITH THONNY'S BACK-END

4,430 views
Skip to first unread message

lujo

unread,
Mar 23, 2022, 10:04:23 AM3/23/22
to thonny
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

Alexandre Villares

unread,
Apr 3, 2022, 6:56:23 PM4/3/22
to thonny

Hi  lujo!

This looks like a thonny-py5mode issue to me, would you care to open an issue at https://github.com/tabreturn/thonny-py5mode
so that Tabreturn can keep track of it?

In the latest versions of the plug-in I'm not using the program arguments field, just having the py5 imported mode menu option "ticked"/selected, does thar make any sense?
Something else to try and see if py5 installed correctly would be:

import py5

def setup():
    py5.size(500, 500)
    py5.fill(255, 0, 0)
    py5.no_stroke()

def draw():
    py5.circle(py5.mouse_x, py5.mouse_y, 10)
    print(py5.frame_count)

py5.run_sketch()

Cheers,
Alexandre

tabreturn

unread,
Apr 4, 2022, 2:00:40 AM4/4/22
to thonny
Hi, Lujo

Yeah -- I'm aware of this. I need to adapt things for Thonny 4 / Python 3.10. Best to follow the setup documentation and stick with Thonny 3.3.7 (Python 3.9) for now. Like @villares has pointed out -- this doesn't require you to fiddle with the program arguments field :)

T
Reply all
Reply to author
Forward
0 new messages