PyCharm:调试器找不到项目模块,但是运行可以

时间:2019-01-04 14:09:03

标签: python debugging pycharm

我有一个带有两个子包的项目(RB):RB /核心和RB /测试。在“核心”包中, init .py导入RB / core / base.py,然后从RB / tests / code_timing.py导入一个名为“定时器”的包装函数,以用作装饰器计时其功能。事实是,当我使用PyCharm的运行模式运行base.py文件时,一切正常,但是当我尝试从调试器运行它时,会出现以下错误:

Traceback (most recent call last):


File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevd.py", line 1741, in <module>
    main()
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevd.py", line 1735, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\pydevd.py", line 1135, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.2\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/nicolas.fonteyne/SCRIPTS/RB/core/base.py", line 9, in <module>
    from tests.code_timing import timer
ModuleNotFoundError: No module named 'tests.code_timing'

预先感谢您的帮助。

0 个答案:

没有答案