English 中文(简体)
在PyDev的Twisted Application
原标题:Running a Twisted Application in PyDev

I would like to debug a Twisted Application (10.0.0) using the Eclipse (3.5.2) PyDev Module (1.6.4) and Python (2.6.5). To run the application from the command line I would specify the following:

c:python26python c:python26scripts wistd.py -ny mytwistedapp。 y

为了利用PyDev实现这一目的,我设立了一个新的PyDev项目,并进口了我的扭曲性申请。 在项目组合下,I具体注明了c:python26scripts wistd。 它是主要模块。 如果我选择了Ron-> Debug Configurations,它就翻了两番。 无参数的py(其中一半,正确?) 如果我试图将方案论点添加到管理组合中(无论我是否曾过错),则由PyDev debugger而不是扭曲。 两个问题:

  1. Is specifying twistd.py as the main module the right approach?
  2. If so, how can I pass twistd.py the parameters it needs to run mytwistedapp.py (-ny mytwistedapp.py)?
问题回答

首先,感谢大家对此事的友好和热情支持!

通过Eclipse的PyDev模块进行扭曲性应用的关键是界定扭曲性。 如同Run Configuration中的主要模块。 可采取以下步骤:

这些指示假定,你本可以在你的系统中进行扭曲性的申请,这意味着你安装了ope和tw。 例如,以下工作已经为你服务:

python twistd.py mytwistapp.tac

These instructions also assume that you have already installed and configured PyDev in Eclipse, including the definition of the PYTHONPATH. 1. Navigate to Window -> Preferences -> PyDev -> Interpreter (Python) 2. Under Libraries Tab (System PYTHONPATH), System Libs should already contain location of your Python instllation (e.g., c:python26, c:python26dlls, c:python26lib, etc). 3. Add the Zope egg and the Twisted folder to System libs. For example, c:python26libsite-packages wisted and c:python26libsite-packageszope.interfaces-3.6.1-py2.6-win32.egg

创建新的Pydev项目

  1. Create a new PyDev project (e.g., MYPROJ)
  2. Import your various twisted application files
  3. * Add twistd.py to your project *. Rather than adding a copy of the file to my project I linked to the existing file (File -> New -> File -> Advanced -> "Link to file in the file system" -> c:python26scripts wistd.py). This is key as you will use twistd.py to run your application from within Eclipse.

既然你的项目已经启动,就产生了一个新的运行配置。

  1. Run -> Run Configurations
  2. Use the following values under the Main Tab
    • Name: Twisted (or whatever)
    • Project: MYPROJ
    • Main Module: ${workspace_loc:MYPROJ/twistd.py}
  3. Use the following values under the Arguments Tab
    • Program Arguments: -ny ${workspace_loc:MYPROJ/mytwistapp.tac}

而这样说! 关键是先进口。 如同主模块一样,后者允许将方案论点传入扭曲。 p,就像你从指挥线做的那样。





相关问题
Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

An enterprise scheduler for python (like quartz)

I am looking for an enterprise tasks scheduler for python, like quartz is for Java. Requirements: Persistent: if the process restarts or the machine restarts, then all the jobs must stay there and ...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single ...

What is suggested seed value to use with random.seed()?

Simple enough question: I m using python random module to generate random integers. I want to know what is the suggested value to use with the random.seed() function? Currently I am letting this ...

How can I make the PyDev editor selectively ignore errors?

I m using PyDev under Eclipse to write some Jython code. I ve got numerous instances where I need to do something like this: import com.work.project.component.client.Interface.ISubInterface as ...

How do I profile `paster serve` s startup time?

Python s paster serve app.ini is taking longer than I would like to be ready for the first request. I know how to profile requests with middleware, but how do I profile the initialization time? I ...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

Converting Dictionary to List? [duplicate]

I m trying to convert a Python dictionary into a Python list, in order to perform some calculations. #My dictionary dict = {} dict[ Capital ]="London" dict[ Food ]="Fish&Chips" dict[ 2012 ]="...

热门标签