1
2:LastChangedDate: $LastChangedDate$
3:LastChangedRevision: $LastChangedRevision$
4:LastChangedBy: $LastChangedBy$
5
6Setting up the TwistedQuotes application
7========================================
8
9
10
11
12
13
14Goal
15----
16
17
18
19This document describes how to set up the TwistedQuotes application used in
20a number of other documents, such as :doc:`designing Twisted applications <design>` .
21
22
23
24
25
26Setting up the TwistedQuotes project directory
27----------------------------------------------
28
29
30
31In order to run the Twisted Quotes example, you will need to do the
32following:
33
34
35
36
37
38#. Make a ``TwistedQuotes`` directory on your system
39#. Place the following files in the ``TwistedQuotes`` directory:
40
41
42
43   -
44
45     :download:`__init__.py <listings/TwistedQuotes/__init__.py>`
46
47     .. literalinclude:: listings/TwistedQuotes/__init__.py
48
49     (this
50     file marks it as a package, see `this section <http://docs.python.org/tutorial/modules.html#packages>`_ of the Python tutorial for more on packages)
51   -
52
53     :download:`quoters.py <listings/TwistedQuotes/quoters.py>`
54
55     .. literalinclude:: listings/TwistedQuotes/quoters.py
56
57   -
58
59     :download:`quoteproto.py <listings/TwistedQuotes/quoteproto.py>`
60
61     .. literalinclude:: listings/TwistedQuotes/quoteproto.py
62
63
64
65#. Add the ``TwistedQuotes`` directory's *parent* to your Python
66   path. For example, if the TwistedQuotes directory's path is
67   ``/mystuff/TwistedQuotes`` or ``c:\mystuff\TwistedQuotes``
68   add ``/mystuff`` to your Python path. On UNIX this would be ``export PYTHONPATH=/mystuff:$PYTHONPATH`` , on Microsoft
69   Windows change the ``PYTHONPATH`` variable through the
70   Systems Properties dialog by adding ``;c:\mystuff`` at the
71   end.
72#.
73   Test your package by trying to import it in the Python interpreter:
74
75   .. code-block:: pycon
76
77
78       Python 2.1.3 (#1, Apr 20 2002, 22:45:31)
79       [GCC 2.95.4 20011002 (Debian prerelease)] on linux2
80       Type "copyright", "credits" or "license" for more information.
81       >>> import TwistedQuotes
82       >>> # No traceback means you're fine.
83
84
85
86