'why the python3 did not hit breakpoint in schedule task in PyCharm

I am using this code to capture Python 3 exception in PyCharm PyCharm 2022.1 (Professional Edition), this is my code look like:

@staticmethod
def parse_single(entry, source):
    try:
        pub_time = entry.get("published", "None")
        guid = entry.get("id", "")
        title = entry.get("title", "")
        author = entry.get("author", "")
        link = entry.get("link", "")
        article_content = entry.get("content", "")
        if article_content is None or len(article_content) == 0:
            article_content = entry.get("summary_detail", "")
            if article_content is None or len(article_content) == 0:
                return
            content = article_content.value
            save_single(guid, pub_time, title, author, content, source, link)
        else:
            content = article_content[0].get("value", "")
            save_single(guid, pub_time, title, author, content, source, link)
    except BaseException as e:
        logger.error("save single rss article data error,rss:" + source.sub_url, e)

I make a breakpoint in the line:

logger.error("save single rss article data error,rss:" + source.sub_url, e)

but when I debug this code, the breakpoint did not trigger and stop in this line. The breakpoint setting to capture Any Exception in PyCharm. why this happen? what should I to do make it stop in breakpoint in PyCharm? Am I missing something? This is the log output:

  File "/home/dolphin/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/212.5457.59/plugins/python/helpers/pydev/pydevd.py", line 2164, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/home/dolphin/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/212.5457.59/plugins/python/helpers/pydev/pydevd.py", line 1476, in run
    return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
  File "/home/dolphin/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/212.5457.59/plugins/python/helpers/pydev/pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/home/dolphin/.local/share/JetBrains/Toolbox/apps/PyCharm-P/ch-0/212.5457.59/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/home/dolphin/Documents/GitHub/pydolphin/dolphin/tests/cruise/rss_test.py", line 13, in <module>
    rss_parse.feeder_parse(rss, "1", "ddd")
  File "/home/dolphin/Documents/GitHub/pydolphin/dolphin/biz/blog/rss/RssParser.py", line 49, in feeder_parse
    RssParser.parse_single(entry, source)
  File "/home/dolphin/Documents/GitHub/pydolphin/dolphin/biz/blog/rss/RssParser.py", line 97, in parse_single
    logger.error("save single rss article data error,rss:" + source.sub_url, e)
Message: 'save single rss article data error,rss:https://incidentdatabase.ai/rss.xml'
Arguments: (IndexError('list index out of range'),)

By the way, when I set a breakpoint in the main function, it works. But when I set the breakpoint in schedule task function, it could not trigger the breakpoint. The schedule code look like this:

# coding=utf-8

import time
from apscheduler.schedulers.background import BackgroundScheduler
from dolphin.biz.dict.fetch_centence import FetchSentence
from dolphin.biz.music.fetch_music import FetchMusic
from dolphin.biz.rss_entry import RssEntry

if __name__ == '__main__':
    scheduler = BackgroundScheduler()
    rss = RssEntry()
    # sentence_fetcher = FetchSentence()
    # music_download_url_fetcher = FetchMusic()
    #
    #
    scheduler.add_job(rss.rss_sub, 'cron', args=['1'], minute='*/1', max_instances=1)
    scheduler.add_job(rss.rss_sub, 'cron', args=['2'], minute='*/1', max_instances=1)
    scheduler.add_job(rss.rss_sub, 'cron', args=['3'], minute='*/1', max_instances=1)
    # scheduler.add_job(sentence_fetcher.fetch, 'cron', args=[], second='*/6', max_instances=1)
    # scheduler.add_job(music_download_url_fetcher.fetch_music_url, 'cron', args=[], minute='*/5', max_instances=1)
    scheduler.start()
    try:
        while True:
            time.sleep(20)
    except (KeyboardInterrupt, SystemExit):
        scheduler.shutdown()

when I set the breakpoint in rss_sub function, it would not work. The parse_single function was nested in the rss_sub function.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source