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

problem when debug a code in thony #3168

Open
akbzam opened this issue Apr 18, 2024 · 1 comment
Open

problem when debug a code in thony #3168

akbzam opened this issue Apr 18, 2024 · 1 comment
Milestone

Comments

@akbzam
Copy link

akbzam commented Apr 18, 2024

hi
The below code is run ok, but in debugging it, a problem is appeared and below text is appeared in popup windows:
Traceback (most recent call last):
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\workbench.py", line 1788, in event_generate
handler(event)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 1217, in _handle_debugger_progress
_current_debugger.handle_debugger_progress(msg)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 278, in handle_debugger_progress
self._main_frame_visualizer.update_this_and_next_frames(msg)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 425, in update_this_and_next_frames
self._next_frame_visualizer.update_this_and_next_frames(msg)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 411, in update_this_and_next_frames
self._update_this_frame(msg, frame_info)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 1018, in _update_this_frame
DialogVisualizer._update_this_frame(self, msg, frame_info)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 972, in _update_this_frame
FrameVisualizer._update_this_frame(self, msg, frame_info)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 470, in _update_this_frame
self._expression_box.update_expression(msg, frame_info)
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 669, in update_expression
self._highlight_range(
File "C:\Program Files (x86)\Thonny\lib\site-packages\thonny\plugins\debugger.py", line 802, in highlight_range
self.text.tag_add(tag, start_index, end_index)
File "C:\Program Files (x86)\Thonny\lib\tkinter_init
.py", line 3869, in tag_add
self.tk.call(
_tkinter.TclError: bad text index "11_12"

code:

#random_password.py
# from:https://treyhunner.com/2018/04/keyword-arguments-in-python/

from random import choice, shuffle
UPPERCASE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
LOWERCASE = UPPERCASE.lower()
DIGITS = "0123456789"
ALL = UPPERCASE + LOWERCASE + DIGITS

def random_password(*, upper, lower, digits, length):
    chars = [
        *(choice(UPPERCASE) for _ in range(upper)),
        *(choice(LOWERCASE) for _ in range(lower)),
        *(choice(DIGITS) for _ in range(digits)),
        *(choice(ALL) for _ in range(length-upper-lower-digits)),
    ]
    shuffle(chars)
    return "".join(chars)
print(random_password(upper=1, lower=1, digits=1, length=8))    # out: such as 'oNA7rYWI'
print(random_password(upper=1, lower=1, digits=1, length=8))    # out: such as 'bjonpuM6'
# but random_password(1,1,1,8) CAUSES ERROR: TypeError: random_password() takes 0 positional arguments but 4 were given

again i must said code is run okey, but in debuggin,problem is appeared in line: chars=[...] inside function.
thanks

@aivarannamaa
Copy link
Member

Thank you for the report! I could reproduce this and will fix it later.

@aivarannamaa aivarannamaa added this to the 5.0.x milestone May 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants