vs代码' python Debugger do do do do do to odoo 10

发布于 2025-01-22 15:09:23 字数 739 浏览 0 评论 0原文

我使用VS Code Extension Python版本2.2X,Python解释器2.7倍,并使用最新版本的Odoo 10。我正在与Ubuntu 18.4 Lts一起使用WSL。

我无法调试我公司创建的自定义模块。我已经在参数中指定了模块的路径,并且确实运行,但它并没有在我指定的断点。

这是我的启动

 {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "/home/ihsansfd/odoo/odoo-bin",
        "python": "/usr/bin/python",
        "args": [
            "--db_port=5434",
            "--addons-path=/mnt/d/kuliah/odoo/repo/MUK/base,/mnt/d/kuliah/odoo/repo/MUK/core,/mnt/d/kuliah/odoo/repo/MUK/modifier",
        ],
        "console": "integratedTerminal",
        "justMyCode": true
    },

。调试。

我真的确定它应该碰到断点,因为我已经在那里设置了一个打印语句并打印了!

任何帮助将不胜感激。如果您需要进一步的细节,请询问。

I use VS Code extension Python version 2.2x, Python interpreter version 2.7x, and use Odoo 10 of the latest version. I'm using WSL with Ubuntu 18.4 LTS.

I cannot debug the custom modules my company creates. I've specified the module's path in the argument, and it does run but it's not breaking at the breakpoints I specified.

Here's my launch.json:

 {
        "name": "Python: Current File",
        "type": "python",
        "request": "launch",
        "program": "/home/ihsansfd/odoo/odoo-bin",
        "python": "/usr/bin/python",
        "args": [
            "--db_port=5434",
            "--addons-path=/mnt/d/kuliah/odoo/repo/MUK/base,/mnt/d/kuliah/odoo/repo/MUK/core,/mnt/d/kuliah/odoo/repo/MUK/modifier",
        ],
        "console": "integratedTerminal",
        "justMyCode": true
    },

Aside from request launch, I also tried attach and using a pip library debugpy for that but it's still only running without debugging.

I am really sure that it should hit the breakpoint because I've set a print statement there and it printed!

Any help would be appreciated. If you need any further detail please do ask.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

离去的眼神 2025-01-29 15:09:23

尽管您提到您已经尝试使用附加 debugpy ,但我正在共享我的配置,因为actactdebugpy 是我每天都没有任何问题的方法。

这是我用来通过debugpy运行odoo的shell命令。

python3 /debug/debugpy --listen 0.0.0.0:5678 <odoo-bin-path> <odoo-args>

Python3更改为python用于您的用例。还将0.0.0.0:5678更改为您需要的任何东西。我喜欢在Docker容器中运行ODOO,这也是我更喜欢仅附加到该过程而不是通过VS代码启动它的原因。

我在/debug/debugpy使用此命令中安装了debugpy debugpy debugpy debugpy

python3 -m pip install debugpy -t /debug

这是我在我的aumination.json.json中使用的启动配置:

{
  "name": "Attach to Odoo",
  "type": "python",
  "justMyCode": false,
  "request": "attach",
  "host": "localhost",
  "port": 5678,
  "pathMappings": [
    ...
    I need path mapping for my setup to map the
    location of my local Odoo source code directory
    to the location of the Odoo source code directory
    inside of the Docker container. Depending on your
    setup, you might be able to just skip this option.
    ...
  ]
}

希望这会有所帮助!

Although you mentioned you've tried using attach with debugpy, I'm sharing my configuration since attach and debugpy is what I use every day without any issues.

Here is the shell command I use to run odoo via debugpy.

python3 /debug/debugpy --listen 0.0.0.0:5678 <odoo-bin-path> <odoo-args>

Change python3 to just python for your use case. Also change 0.0.0.0:5678 to whatever you need as well. I like to run Odoo inside a Docker container, and that's also the reason why I prefer to simply attach to the process rather than launching it right from VS Code.

I installed debugpy to /debug/debugpy using this command:

python3 -m pip install debugpy -t /debug

Here is the launch configuration I use in my launch.json:

{
  "name": "Attach to Odoo",
  "type": "python",
  "justMyCode": false,
  "request": "attach",
  "host": "localhost",
  "port": 5678,
  "pathMappings": [
    ...
    I need path mapping for my setup to map the
    location of my local Odoo source code directory
    to the location of the Odoo source code directory
    inside of the Docker container. Depending on your
    setup, you might be able to just skip this option.
    ...
  ]
}

Hopefully this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文