python - Running a Twisted Application in PyDev -
i debug twisted application (10.0.0) using eclipse (3.5.2) pydev module (1.6.4) , python (2.6.5). run application command line specify following:
c:\python26\python c:\python26\scripts\twistd.py -ny mytwistedapp.py
to accomplish using pydev created new pydev project , imported mytwistedapp.py , twistd.py. under project's run configuration specified c:\python26\scripts\twistd.py main module. if select run -> debug configurations runs twistd.py no parameters (half-way there, right?). if try add program arguments run configuration (-ny mytwistedapp.py) processed pydev debugger instead of twistd.py. 2 questions:
- is specifying twistd.py main module right approach?
- if so, how can pass twistd.py parameters needs run mytwistedapp.py (-ny mytwistedapp.py)?
first off, thank kind , gracious support in matter!
the key running twisted application via pydev module of eclipse define twistd.py main module in run configuration. following steps can used:
these instructions assume can run twisted applications on system, means you've installed zope , twisted. example, following works you:
python twistd.py mytwistapp.tac
these instructions assume have installed , configured pydev in eclipse, including definition of pythonpath. 1. navigate window -> preferences -> pydev -> interpreter (python) 2. under libraries tab (system pythonpath), system libs should contain location of python instllation (e.g., c:\python26, c:\python26\dlls\, c:\python26\lib, etc). 3. add zope egg , twisted folder system libs. example, c:\python26\lib\site-packages\twisted , c:\python26\lib\site-packages\zope.interfaces-3.6.1-py2.6-win32.egg
create new pydev project
- create new pydev project (e.g., myproj)
- import various twisted application files
- * add twistd.py project *. rather adding copy of file project linked existing file (file -> new -> file -> advanced -> "link file in file system" -> c:\python26\scripts\twistd.py). key use twistd.py run application within eclipse.
now project setup, create new run configuration.
- run -> run configurations
- use following values under main tab
- name: twisted (or whatever)
- project: myproj
- main module: ${workspace_loc:myproj/twistd.py}
- use following values under arguments tab
- program arguments: -ny ${workspace_loc:myproj/mytwistapp.tac}
and that's it! key importing twistd.py main module, allows program arguments passed twsttd.py, command line.
Comments
Post a Comment