Running a twisted program in PyDev

I would like to debug Twisted Application (10.0.0) using the PyDev (1.6.4) module Eclipse (3.5.2) and Python (2.6.5). To start the application from the command line, I would indicate the following:

c: \ python26 \ python c: \ python26 \ scripts \ twistd.py -ny mytwistedapp.py

To accomplish this with PyDev, I created a new PyDev project and imported mytwistedapp.py and twistd.py. In the project launch configuration, I specified c: \ python26 \ scripts \ twistd.py as the main module. If I select Run -> Debug Configurations, it will run twistd.py without parameters (halfway, right?). If I try to add program arguments to the startup configuration (-ny mytwistedapp.py), they are processed by the PyDev debugger instead of twistd.py. Two questions:

  • Determines if twistd.py is the main module the correct approach?
  • If so, how can I pass twistd.py the parameters needed to run mytwistedapp.py (-ny mytwistedapp.py)?
+3
source share
1 answer

First of all, thank you all for your kind and kind support in this matter!

The key to running a twisted application through the PyDev Eclipse module is to define twistd.py as the main module in the launch configuration. You can use the following steps:

These instructions assume that you can already run twisted applications on your system, which means that you have installed zope and twisted. For example, the following already works for you:

python twistd.py mytwistapp.tac

, PyDev Eclipse, PYTHONPATH. 1. → → PyDev → (Python) 2. "" (System PYTHONPATH) Python (, c:\python26, c:\python26\dlls \, c:\python26\lib ..). 3. Zope Twisted . , c:\python26\lib\site-packages\twisted c:\python26\lib\site-packages\zope.interfaces-3.6.1-py2.6-win32.egg

Pydev

  • PyDev (, MYPROJ)
  • * twistd.py *. ( → → → → " " → c:\python26\scripts\twistd. ). , twistd.py Eclipse.

, , .

  • Run → Run Configurations
  • " "
    • : Twisted ( - )
    • : MYPROJ
    • : ${workspace_loc: MYPROJ/twistd.py}
  • ""
    • : -ny ${workspace_loc: MYPROJ/mytwistapp.tac}

! twistd.py , twsttd.py, .

+3

Source: https://habr.com/ru/post/1787707/


All Articles