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

Breakpoints set in modules running in separate thread are ignored. #1224

Open
FaceCrap opened this issue Oct 1, 2023 · 4 comments
Open

Breakpoints set in modules running in separate thread are ignored. #1224

FaceCrap opened this issue Oct 1, 2023 · 4 comments

Comments

@FaceCrap
Copy link

FaceCrap commented Oct 1, 2023

It looks like PyScripter will only debug code in the main thread. Breakpoints set in modules which run in a separate thread are completely ignored.

@FaceCrap FaceCrap changed the title Debuggin modules running in separate thread does not seem to work. Debugging modules running in separate thread does not seem to work. Oct 1, 2023
@FaceCrap FaceCrap changed the title Debugging modules running in separate thread does not seem to work. Breakpoints set in modules running in separate thread are ignored. Oct 1, 2023
@pyscripter
Copy link
Owner

pyscripter commented Oct 2, 2023

Cannot reproduce here (see below). Which version of PyScripter are you using?
Could you please provide a minimal python script to replicate the issue.

@pyscripter
Copy link
Owner

pyscripter commented Oct 2, 2023

image
As you can see here, there are two threads paused (stopped at a breakpoint). The main thread is running, but waiting for the other threads to finish.
You can inspect the call stack, variables etc of each paused thread.

When you press resume all paused threads will start again.

@FaceCrap
Copy link
Author

FaceCrap commented Oct 6, 2023

I'm running version 4.2.5.0

and a minimal script... I'm by far no python expert and I'm dealing with a GUI app built with PyQt6 which I didn't create myself.
I don't see how I can even begin to reduce this app to a minimum example and have it still working...

@pyscripter
Copy link
Owner

Please try with the preview of the next version.

I works here with the following script:

from PyQt6.QtCore import *
from PyQt6.QtWidgets import *
from requests import Session
from threading import Thread
from time import sleep

name = "John" #input("Please enter your name: ")
chat_url = "https://build-system.fman.io/chat"
server = Session()

# GUI:
app = QApplication([])
text_area = QPlainTextEdit()
message = QLineEdit()
layout = QVBoxLayout()
layout.addWidget(text_area)
layout.addWidget(message)
window = QWidget()
window.setLayout(layout)
window.show()

# Event handlers:
new_messages = []
def fetch_new_messages():
    while True:
        response = server.get(chat_url).text
        if response:
            new_messages.append(response)
        sleep(.5)

thread = Thread(target=fetch_new_messages, daemon=True)
thread.start()

def display_new_messages():
    while new_messages:
        text_area.appendPlainText(new_messages.pop(0))

def send_message():
    server.post(chat_url, {"name": name, "message": message.text()})
    message.clear()

# Signals:
message.returnPressed.connect(send_message)
timer = QTimer()
timer.timeout.connect(display_new_messages)
timer.start(1000)

app.exec()

image

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

2 participants