1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
3
<!-- $Id: 3-install.html,v 2.30 2004/05/27 23:03:04 irmen Exp $ -->
3
<!-- $Id: 3-install.html,v 2.44 2007/03/07 23:08:19 irmen Exp $ -->
5
<title>PYRO - Installation</title>
5
<title>PYRO - Installation</title>
6
<link rel="stylesheet" type="text/css" href="pyromanual_print.css" media="print">
7
<link rel="stylesheet" type="text/css" href="pyromanual.css" media="screen">
7
<body background="backdrop.jpg">
8
<table border="0" width="100%">
10
<td align="left"><a href="2-concepts.html"><previous</a> | <a href="PyroManual.html">contents</a> | <a href="4-usage.html">next></a>
11
<td align="right">Pyro Manual
17
<h2><u>3. Installation and Configuration</u></h2>
18
Please read this entire chapter before trying to install Pyro. Not
19
that it's complex, but just that you've seen the choices you have to make.
20
<p><strong>Installation</strong><p>
21
Pyro distributions contain a "distutils" <code>setup.py</code> script
22
that will install Pyro for you; just enter the following command from a shell prompt:
23
"<code>python setup.py install</code>" and off you go.
24
The script will ask if you want to install the Pyro script tools, and where to put them.
25
If you want to do an automated (unattended) install, edit the <code>setup.cfg</code> file,
26
following the directions in that file.
27
<em>It will not install the documentation and the examples, only the core Pyro library and the scripts.</em>
28
<p>But I will explain what exactly is in the Pyro distribution. It has a few subdirectories:
30
<dt><code>Pyro/</code></dt>
31
<dd> This is the actual Pyro package. If you do not use the supplied <code>setup.py</code>
32
install script (see above) you have to install it by hand.
33
Install this directory somewhere in your Python search path. On most systems (also Windows),
34
the <code>lib/site-packages</code> directory is a nice place. The exact location might
35
vary according to your specific Python installation.
36
<dd> Alternatively, keep it where it is and manually add the Pyro root directory
37
to your Python search path (e.g. in the environment variable <code>PYTHONPATH</code>).</dd>
38
<dt><code>bin/</code></dt>
39
<dd> This directory contains the command-line utilities. Move the contents of this directory somewhere in your shell search path.</dd>
40
<dd> Alternatively, keep it where it is and manually add it to your shell search
42
<dt><code>docs/</code> and <code>examples/</code></dt>
43
<dd>Put those wherever you like. In docs you can find the Pyro manual, and in examples there are some Pyro examples.</dd>
46
<p><strong>Configuration</strong><p>
47
The default settings will do nicely in most cases. But sooner or later you will have to change some parameters of Pyro.
48
Pyro's configuration is accessed through <code>Pyro.config</code>. This object has several configuration items:<br>
50
<tr><th>Configuration item<th>Type<th>Description<th>Default value
51
<tr><td><code>PYRO_CONFIG_FILE</code>
53
<td>The Pyro configuration file that is used. See below.
54
<td>Special, see below</tr>
55
<tr><td><code>PYRO_STORAGE</code>
57
<td>Location where Pyro stores data like log files. <em>Read the notice at the end!</em>
58
<td><i>Current directory</i></tr>
59
<tr><td><code>PYRO_LOGFILE</code>
61
<td>Name of the logfile. If it's not an absolute path, it's relative to <code>$PYRO_STORAGE</code>. It's best to modify this <em>before</em> importing <code>Pyro.util</code>!
62
<td><code>Pyro_log</code></tr>
63
<tr><td><code>PYRO_USER_LOGFILE</code>
65
<td>Name of the user logfile. If it's not an absolute path, it's relative to <code>$PYRO_STORAGE</code>.
66
<td><code>Pyro_userlog</code></tr>
67
<tr><td><code>PYRO_TRACELEVEL</code>
69
<td>The tracing level of Pyro, 0-3. 0=nothing, 1=only errors, 2=warnings too, 3=full: errors, warnings and notes.
71
<tr><td><code>PYRO_USER_TRACELEVEL</code>
73
<td>The user tracing level, 0-3. 0=nothing, 1=only errors, 2=warnings too, 3=full: errors, warnings and notes.
75
<tr><td><code>PYRO_DETAILED_TRACEBACK</code>
77
<td>Should Pyro dump detailed tracebacks (with dumps of local variable's values)? If set to 1 on the server, the clients will get
78
detailed tracebacks from inside the server's code. You may not want this (security)...
80
<tr><td><code>PYRO_PRINT_REMOTE_TRACEBACK</code>
82
<td>Should Pyro print remote traceback information inside exception tracebacks?
84
<tr><td><code>PYRO_STDLOGGING</code>
86
<td>Should Pyro use new-style logging using the <code>logging</code> module (Python 2.3+)?
88
<tr><td><code>PYRO_STDLOGGING_CFGFILE</code>
90
<td>Name of the configuration file that is used to configure the new-style logging. If it's not an absolute path, it's relative to <code>$PYRO_STORAGE</code>.
91
If this file doesn't exist, Pyro uses the default configuration that resembles the classic Pyro logging style.
92
<td><code>logging.cfg</code></tr>
93
<tr><td><code>PYRO_PICKLE_FORMAT</code>
95
<td>The pickle protocol format that Pyro will use for marshaling.
96
<td><code>pickle.HIGHEST_PROTOCOL</code> on Python 2.3+, else 1</tr>
97
<tr><td><code>PYRO_XML_PICKLE</code>
99
<td>Whether the marshaling is done using the safe xml pickling (from Gnosis_utils or PyXML) or the default pickle.
100
The xml_pickle is not vulnerable for the <a href="9-security.html#pickle">pickle trojan problem</a>, but it is an
101
order of a magnitude slower, and requires more bandwith.
102
Use "any" for any implementation (defaults to PyXML), "pyxml" for PyXML, "gnosis" for Gnosis.
103
PyXML seems to be about three to four times faster than Gnosis, this
104
could be because PyXML uses extension modules built in C.
105
You need to have installed <a href="http://gnosis.cx/download/">Gnosis_Utils</a> (at least version 1.0.2, latest is 1.1.0 at the time of writing).
106
For <a href="http://sourceforge.net/project/showfiles.php?group_id=6473">PyXML</a>, you need at least version 0.8, latest is 0.8.3 at the time of writing.
107
<td><i>empty</i> (disabled)</tr>
108
<tr><td><code>PYRO_COMPRESSION</code>
110
<td>Whether the protocol should compress the data to save bandwidth (at the cost of CPU time).
111
The <code>zlib</code> module is used for compression. If you don't have <code>zlib</code>, Pyro still works, but without compression.
113
<tr><td><code>PYRO_CHECKSUM</code>
115
<td>Whether the protocol should perform a checksum over the message data. This costs a little bit extra CPU time, but you
116
will be quite sure that your communication is without errors.
117
The <code>zlib.adler32</code> function is used for checksumming. If you don't have <code>zlib</code>, Pyro still works, but without checksumming.
118
The overhead of checksumming is very small, with regular messages less than 0.1%, but
119
increasing with big messages (15% for 5 Mb or so).
120
<strong>Note:</strong> the checksum is by no means secure. If you want secure transmissions,
121
you'll have to use SSL or build your own encryption/secure hashing functions on top of Pyro.
123
<tr><td><code>PYRO_SOCK_KEEPALIVE</code>
125
<td>Whether Pyro should set the SO_KEEPALIVE socket option on the network sockets. This is used to detect broken client connections, to let the Pyro server clean them up nicely. It is enabled by default, but it could cause problems in certain situations so you can turn it off if you want.
126
The timeout period is system-dependent but usually around 2 hours. It depends on your OS how to change this value, but have a look at "sysctl". (This feature may not be available on all
127
OS's, if your OS doesn't support it, Pyro will automatically switch it off).
129
<tr><td><code>PYRO_MAXCONNECTIONS</code>
131
<td>The maximum number of simultaneous connections to one Pyro server. Note that a custom connection validator may or may not take this in account. The default validator does check for this limit.
133
<tr><td><code>PYRO_TCP_LISTEN_BACKLOG</code>
135
<td>The size of the TCP socket listen backlog for Pyro daemons.
137
<tr><td><code>PYRO_MULTITHREADED</code>
139
<td>Whether Pyro servers should be multithreaded or not.
140
<td>1 (if supported)</tr>
141
<tr><td><code>PYRO_MOBILE_CODE</code>
143
<td>On the server: whether Pyro should automatically download Python code from clients if
144
it isn't available on the server. On the client: whether Pyro should automatically download Python code from the
145
server if it returns objects that aren't available on the client.
147
<tr><td><code>PYRO_DNS_URI</code>
149
<td>Whether symbolic DNS host names should be used in URIs instead of fixed IP addresses.
151
<tr><td><code>PYRO_BC_RETRIES</code>
153
<td>How often a broadcast will be retried if no answer has been received. Currently only used by the Name Server locator.
155
<tr><td><code>PYRO_BC_TIMEOUT</code>
157
<td>How long Pyro will wait (in seconds) for an answer to a broadcast request. Currently only used by the Name Server locator.
159
<tr><td><code>PYRO_PORT</code>
161
<td>The base socket number of the range of socket numbers that the Pyro daemon can use to listen for incoming requests (Pyro method calls).
163
<tr><td><code>PYRO_PORT_RANGE</code>
165
<td>The size of the socket port range. Pyro will try to claim a socket for its Deamons in the socket port range PYRO_PORT to (but not including) PYRO_PORT+PYRO_PORT_RANGE.
166
This means that if Pyro already has a Daemon listning on socket N, a new Deamon will claim socket N+1, and so on. You can disable
167
this by using a special argument when construction a Daemon (or setting this item to 1).
169
<tr><td><code>PYRO_NS_DEFAULTGROUP</code>
171
<td>The default group name in which names are located. <em>This must be an absolute name (starting with the root character).</em>
172
<td><code>:Default</code>
173
<tr><td><code>PYRO_NS_URIFILE</code>
175
<td>The file where the Name Server will write its URI. If it's not an absolute path, it's relative to <code>$PYRO_STORAGE</code>.
176
<td><code>Pyro_NS_URI</code>
177
<tr><td><code>PYRO_NS_HOSTNAME</code>
179
<td>The hostname that is tried to find the NameServer on, when the broadcast lookup mechanism fails.
180
<td><i>empty</i></tr>
181
<tr><td><code>PYRO_NS_PORT</code>
183
<td>The socket number on which the Name Server will listen for incoming requests (Pyro method calls, in fact).
185
<tr><td><code>PYRO_NS_BC_PORT</code>
187
<td>The socket number on which the Name Server will listen for broadcast requests (usually to find the location).
189
<tr><td><code>PYRO_NS2_HOSTNAME</code>
191
<td>Like above, but for the second (paired) Name Server.
192
<td><i>empty</i></tr>
193
<tr><td><code>PYRO_NS2_PORT</code>
195
<td>Like above, but for the second (paired) Name Server.
197
<tr><td><code>PYRO_NS2_BC_PORT</code>
199
<td>Like above, but for the second (paired) Name Server.
201
<tr><td><code>PYRO_ES_QUEUESIZE</code>
203
<td>The size of the message queues per subscriber that the Event Server allocates. Use 0 (zero) for infinite size.
205
<tr><td><code>PYRO_ES_BLOCKQUEUE</code>
207
<td>If true (1), a publisher will block if an event queue on the server is full,
208
and continue as soon as the queue has some space again. If false (0),
209
the publisher won't block, but <em>the event is lost</em>.
211
<tr><td><code>PYROSSL_CERTDIR</code>
213
<td>The directory where openssl certificates are stored.
214
<td>'certs' in the PYRO_STORAGE location.</tr>
215
<tr><td><code>PYROSSL_CA_CERT</code>
217
<td>Certificate of the Certificate Authority. Used to check if client and server certificates are valid (that they are signed by the given CA)
219
<tr><td><code>PYROSSL_SERVER_CERT</code>
221
<td>Certificate for server side
223
<tr><td><code>PYROSSL_CLIENT_CERT</code>
225
<td>Certificate for client side
229
There are several ways to change the default settings:
231
<li>Change the settings in your code, at runtime. You can change all settings before starting Pyro, and most settings can be changed dynamically during execution too.
232
<em>Note that you cannot use this to change <code>Pyro.config.PYRO_STORAGE</code>! See below!</em>
233
<br>...<code> Pyro.config.PYRO_PORT = 7000</code><br>
234
...<code> Pyro.config.PYRO_TRACELEVEL = 3</code>
235
<li>Define environment variables that override the default settings.
236
<br>Every configuration item has an equivalent environment variable. If you define this, you can override the default setting for that item. For instance, it might be convenient to have your Pyro programs generate log files and put them in a designated log directory:<br>
237
...<code>$ export PYRO_LOGFILE=/var/log/PYRO/logfile</code><br>
238
...<code>$ export PYRO_TRACELEVEL=3</code><br>
239
(This is for bash - syntax is different for other shells or Windows.)
240
<li>Configuration files
241
<br>You can use a configuration file that can contain some small configuration changes or a fully new configuration for all items.
242
Pyro checks if the environment variable <code>PYRO_CONFIG_FILE</code> is set. If it isn't set, or set to an empty string, Pyro checks for a <code>Pyro.conf</code> file in the current directory.
243
If it exists, Pyro uses it as a configuration file. If it doesn't exist, Pyro uses the default built-in configuration.
244
<br>If the environment variable is set, Pyro uses the value as the name for the configuration file. If the configuration file can't be read, a PyroError exception occurs.
246
The format of the configuration file is very simple. It is a text file, and each line can be empty, a comment, or a configuration item setting.
247
A comment starts with '#'. A config item setting is of the format 'ITEM=VALUE'. If Pyro finds an unknown config item, a KeyError exception occurs.
249
Note that <code>PYRO_CONFIG_FILE</code> is useless inside a configuration file. After initialization, it is set to the absolute path of the configuration file that was used (or the empty string, if no configuration file was used).
250
Note that setting <code>PYRO_CONFIG_FILE</code> from within your code is useless too because Pyro is already initialized at that point.
252
Environment variables override configuration file settings. Configuration file settings override the built-in default settings.
253
<p><code>PYRO_STORAGE</code> is used at initialization time, that is, as soon as a part of the Pyro package is imported in your program.
254
You can only change <code>PYRO_STORAGE</code> <em>beforehand</em> by either setting the
255
environment variable or making an entry in the configuration file. Changing <code>Pyro.config.PYRO_STORAGE</code>
256
in your program leads to unexpected results, because the initilization has already been done
257
using the old value. So don't do this, and use one of the two other ways.
259
<table border="0" width="100%">
261
<td align="left"><a href="2-concepts.html"><previous</a> | <a href="PyroManual.html">contents</a> | <a href="4-usage.html">next></a>
262
<td align="right">Pyro Manual
14
<td align="left"><a href="2-concepts.html"><previous</a> | <a href="PyroManual.html">contents</a> | <a href=
15
"4-usage.html">next></a></td>
17
<td align="right">Pyro Manual</td>
22
<h2><u>3. Installation and Configuration</u></h2>Please read this entire chapter before trying to install Pyro.
23
Not that it's complex, but just that you've seen the choices you have to make.
25
<p><strong>Installation</strong></p>
27
<p>Pyro distributions contain a "distutils" <code>setup.py</code> script that will install
28
Pyro for you; just enter the following command from a shell prompt: " <code>python setup.py
29
install</code>" and
30
off you go. The script will ask if you want to install the Pyro script tools, and where to put
31
them. If you want to do an automated (unattended) install, edit the <code>setup.cfg</code> file,
32
following the directions in that file. <em>It will not install the
33
documentation and the examples, only the core Pyro library and the scripts.</em></p>
35
<p>But I will explain what exactly is in the Pyro distribution. It has a few subdirectories:</p>
38
<dt><code>Pyro/</code></dt>
40
<dd>This is the actual Pyro package. If you do not use the supplied <code>setup.py</code> install script (see
41
above) you have to install it by hand. Install this directory somewhere in your Python search path. On most systems
42
(also Windows), the <code>lib/site-packages</code> directory is a nice place. The exact location might vary
43
according to your specific Python installation.</dd>
45
<dd>Alternatively, keep it where it is and manually add the Pyro root directory to your Python search path (e.g. in
46
the environment variable <code>PYTHONPATH</code>).</dd>
48
<dt><code>bin/</code></dt>
50
<dd>This directory contains the command-line utilities. Move the contents of this directory somewhere in your shell
53
<dd>Alternatively, keep it where it is and manually add it to your shell search path.</dd>
55
<dt><code>docs/</code> and <code>examples/</code></dt>
57
<dd>Put those wherever you like. In docs you can find the Pyro manual, and in examples there are some Pyro
61
<p><strong>Configuration</strong></p>
63
<p>The default settings will do nicely in most cases. But sooner or later you will have to change some parameters of
64
Pyro. Pyro's configuration is accessed through <code>Pyro.config</code>. This object has several configuration
69
<th>Configuration item</th>
75
<th>Default value</th>
79
<td><code>PYRO_CONFIG_FILE</code></td>
83
<td>The Pyro configuration file that is used. See below.</td>
85
<td>Special, see below</td>
89
<td><code>PYRO_STORAGE</code></td>
93
<td>Location where Pyro stores data like log files. <em>Read the notice at the end!</em></td>
95
<td><i>Current directory</i></td>
99
<td><code>PYRO_LOGFILE</code></td>
103
<td>Name of the logfile. If it's not an absolute path, it's relative to <code>$PYRO_STORAGE</code>. It's best to
104
modify this <em>before</em> importing <code>Pyro.util</code>!</td>
106
<td><code>Pyro_log</code></td>
110
<td><code>PYRO_USER_LOGFILE</code></td>
114
<td>Name of the user logfile. If it's not an absolute path, it's relative to <code>$PYRO_STORAGE</code>.</td>
116
<td><code>Pyro_userlog</code></td>
120
<td><code>PYRO_TRACELEVEL</code></td>
124
<td>The tracing level of Pyro, 0-3. 0=nothing, 1=only errors, 2=warnings too, 3=full: errors, warnings and
131
<td><code>PYRO_USER_TRACELEVEL</code></td>
135
<td>The user tracing level, 0-3. 0=nothing, 1=only errors, 2=warnings too, 3=full: errors, warnings and
142
<td><code>PYRO_DETAILED_TRACEBACK</code></td>
146
<td>Should Pyro dump detailed tracebacks (with dumps of local variable's values)? If set to 1 on the server, the
147
clients will get detailed tracebacks from inside the server's code. You may not want this (security)...</td>
153
<td><code>PYRO_STDLOGGING</code></td>
157
<td>Should Pyro use new-style logging using the <code>logging</code> module (Python 2.3+)?</td>
163
<td><code>PYRO_STDLOGGING_CFGFILE</code></td>
167
<td>Name of the configuration file that is used to configure the new-style logging. If it's not an absolute path,
168
it's relative to <code>$PYRO_STORAGE</code>. If this file doesn't exist, Pyro uses the default configuration that
169
resembles the classic Pyro logging style.</td>
171
<td><code>logging.cfg</code></td>
175
<td><code>PYRO_PICKLE_FORMAT</code></td>
179
<td>The pickle protocol format that Pyro will use for marshaling.</td>
181
<td><code>pickle.HIGHEST_PROTOCOL</code> on Python 2.3+, else 1</td>
185
<td><code>PYRO_XML_PICKLE</code></td>
189
<td>Whether the marshaling is done using the safe xml pickling or
190
the default pickle. The xml_pickle is not vulnerable for the <a href="9-security.html#pickle">pickle
191
trojan problem</a>, but
192
it is an order of a magnitude slower, and requires more bandwith.
193
Set to "gnosis" for Gnosis XML pickler. There are no other options available at this time.
194
You need to have installed <a href=
195
"http://gnosis.cx/download/">Gnosis_Utils</a> (at least version 1.2.x).
196
Note that you have to use the same Gnosis XML library version everywhere. You can't mix older versions with newer versions. </td>
197
<td><i>empty</i> (disabled)</td>
201
<td><code>PYRO_GNOSIS_PARANOIA</code></td>
203
<td>The 'paranoia' setting that will be used for the Gnosis XML pickler. Higher=more secure.
204
The default setting (0) prevents automatic imports of modules during unpickling.
205
Set it to -1 to enable automatic imports of user defined modules.
206
When you use the mobile code feature together with Gnosis XML pickling, you need
207
to set it to -1 as well.</td>
212
<td><code>PYRO_COMPRESSION</code></td>
216
<td>Whether the protocol should compress the data to save bandwidth (at the cost of CPU time). The
217
<code>zlib</code> module is used for compression. If you don't have <code>zlib</code>, Pyro still works, but
218
without compression.</td>
224
<td><code>PYRO_CHECKSUM</code></td>
228
<td>Whether the protocol should perform a checksum over the message data. This costs a little bit extra CPU time,
229
but you will be quite sure that your communication is without errors. The <code>zlib.adler32</code> function is
230
used for checksumming. If you don't have <code>zlib</code>, Pyro still works, but without checksumming. The
231
overhead of checksumming is very small, with regular messages less than 0.1%, but increasing with big messages
232
(15% for 5 Mb or so). <strong>Note:</strong> the checksum is by no means secure. If you want secure
233
transmissions, you'll have to use SSL or build your own encryption/secure hashing functions on top of Pyro.</td>
239
<td><code>PYRO_SOCK_KEEPALIVE</code></td>
243
<td>Whether Pyro should set the SO_KEEPALIVE socket option on the network sockets. This is used
244
to detect broken client connections, to let the Pyro server clean them up nicely. It is enabled
245
by default, but it could cause problems in certain situations so you can turn it off if you
246
want. The timeout period is system-dependent but usually around 2 hours. It depends on your
247
OS how to change this value, but have a look at "sysctl". (This
248
feature may not be available on all OS's, if your OS doesn't support it, Pyro will automatically
255
<td><code>PYRO_MAXCONNECTIONS</code></td>
259
<td>The maximum number of simultaneous connections to one Pyro server. Note that a custom connection validator
260
may or may not take this in account. The default validator does check for this limit.</td>
266
<td><code>PYRO_TCP_LISTEN_BACKLOG</code></td>
270
<td>The size of the TCP socket listen backlog for Pyro daemons.</td>
276
<td><code>PYRO_BROKEN_MSGWAITALL</code></td>
278
<td>Some systems have broken socket MSG_WAITALL support. Set this item to 1 if your system is one of these. When
279
set to 1, Pyro will use a different piece of code to receive data (slower, but working on these systems as well). </td>
283
<td><code>PYRO_MULTITHREADED</code></td>
287
<td>Whether Pyro servers should be multithreaded or not.</td>
289
<td>1 (if supported)</td>
293
<td><code>PYRO_MOBILE_CODE</code></td>
297
<td>On the server: whether Pyro should automatically download Python code from clients if it isn't available on
298
the server. On the client: whether Pyro should automatically download Python code from the server if it returns
299
objects that aren't available on the client.</td>
305
<td><code>PYRO_DNS_URI</code></td>
309
<td>Whether symbolic DNS host names should be used in URIs instead of fixed IP addresses.</td>
315
<td><code>PYRO_BC_RETRIES</code></td>
319
<td>How often a broadcast will be retried if no answer has been received. Currently only used by the Name Server
320
locator. A negative number (<0) means infinitely. </td>
326
<td><code>PYRO_BC_TIMEOUT</code></td>
330
<td>How long Pyro will wait (in seconds) for an answer to a broadcast request. Currently only used by the Name
331
Server locator. A negative number (<0) means infinitely.</td>
337
<td><code>PYRO_PORT</code></td>
341
<td>The base socket number of the range of socket numbers that the Pyro daemon can use to listen for incoming
342
requests (Pyro method calls).</td>
348
<td><code>PYRO_PORT_RANGE</code></td>
352
<td>The size of the socket port range. Pyro will try to claim a socket for its Deamons in the socket port range
353
PYRO_PORT to (but not including) PYRO_PORT+PYRO_PORT_RANGE. This means that if Pyro already has a Daemon listning
354
on socket N, a new Deamon will claim socket N+1, and so on. You can disable this by using a special argument when
355
construction a Daemon (or setting this item to 1).</td>
361
<td><code>PYRO_HOST</code></td>
365
<td>The hostname Pyro's daemon will bind on. Useful when your machine has multiple hostnames/network adapters
366
on which it can listen. (Also influences NameServer.)</td>
368
<td>'' <em>(default host)</em></td>
372
<td><code>PYRO_PUBLISHHOST</code></td>
376
<td>the hostname that Pyro daemons will use when publishing URIs. Useful in case of a firewall/NAT setup.
377
See the Features chapter for firewall info. </td>
379
<td>None <em>(same as normal hostname)</em></td>
383
<td><code>PYRO_NS_DEFAULTGROUP</code></td>
387
<td>The default group name in which names are located. <em>This must be an absolute name (starting with the root
388
character).</em></td>
390
<td><code>:Default</code></td>
394
<td><code>PYRO_NS_URIFILE</code></td>
398
<td>The file where the Name Server will write its URI. If it's not an absolute path, it's relative to
399
<code>$PYRO_STORAGE</code>.</td>
401
<td><code>Pyro_NS_URI</code></td>
405
<td><code>PYRO_NS_HOSTNAME</code></td>
409
<td>The hostname that is tried to find the NameServer on, when the broadcast lookup mechanism fails.</td>
411
<td><i>empty</i></td>
415
<td><code>PYRO_NS_PORT</code></td>
419
<td>The socket number on which the Name Server will listen for incoming requests (Pyro method calls, in
426
<td><code>PYRO_NS_BC_PORT</code></td>
430
<td>The socket number on which the Name Server will listen for broadcast requests (usually to find the
437
<td><code>PYRO_NS2_HOSTNAME</code></td>
441
<td>Like above, but for the second (paired) Name Server.</td>
443
<td><i>empty</i></td>
447
<td><code>PYRO_NS2_PORT</code></td>
451
<td>Like above, but for the second (paired) Name Server.</td>
457
<td><code>PYRO_NS2_BC_PORT</code></td>
461
<td>Like above, but for the second (paired) Name Server.</td>
467
<td><code>PYRO_ES_QUEUESIZE</code></td>
471
<td>The size of the message queues per subscriber that the Event Server allocates. Use 0 (zero) for infinite
478
<td><code>PYRO_ES_BLOCKQUEUE</code></td>
482
<td>If true (1), a publisher will block if an event queue on the server is full, and continue as soon as the
483
queue has some space again. If false (0), the publisher won't block, but <em>the event is lost</em>
484
(but only for the subscriber who has a full queue).</td>
490
<td><code>PYROSSL_CERTDIR</code></td>
494
<td>The directory where openssl certificates are stored.</td>
496
<td>'certs' in the PYRO_STORAGE location.</td>
500
<td><code>PYROSSL_CA_CERT</code></td>
504
<td>Certificate of the Certificate Authority. Used to check if client and server certificates are valid (that
505
they are signed by the given CA)</td>
511
<td><code>PYROSSL_SERVER_CERT</code></td>
515
<td>Certificate for server side</td>
521
<td><code>PYROSSL_CLIENT_CERT</code></td>
525
<td>Certificate for client side</td>
531
<p>There are several ways to change the default settings:</p>
534
<li>Change the settings in your code, at runtime. You can change all settings before starting Pyro, and most
535
settings can be changed dynamically during execution too. <em>Note that you cannot use this to change
536
<code>Pyro.config.PYRO_STORAGE</code>! See below!</em><br>
537
... <code>Pyro.config.PYRO_PORT = 7000</code><br>
538
... <code>Pyro.config.PYRO_TRACELEVEL = 3</code></li>
540
<li>Define environment variables that override the default settings.<br>
541
Every configuration item has an equivalent environment variable. If you define this, you can override the default
542
setting for that item. For instance, it might be convenient to have your Pyro programs generate log files and put
543
them in a designated log directory:<br>
544
...<code>$ export PYRO_LOGFILE=/var/log/PYRO/logfile</code><br>
545
...<code>$ export PYRO_TRACELEVEL=3</code><br>
546
(This is for bash - syntax is different for other shells or Windows.)</li>
548
<li>Configuration files<br>
549
You can use a configuration file that can contain some small configuration changes or a fully new configuration
550
for all items. Pyro checks if the environment variable <code>PYRO_CONFIG_FILE</code> is set. If it isn't set, or
551
set to an empty string, Pyro checks for a <code>Pyro.conf</code> file in the current directory. If it exists,
552
Pyro uses it as a configuration file. If it doesn't exist, Pyro uses the default built-in configuration.<br>
553
If the environment variable is set, Pyro uses the value as the name for the configuration file. If the
554
configuration file can't be read, a PyroError exception occurs.
556
<p>The format of the configuration file is very simple. It is a text file, and each line can be empty, a comment,
557
or a configuration item setting. A comment starts with '#'. A config item setting is of the format 'ITEM=VALUE'.
558
If Pyro finds an unknown config item, a KeyError exception occurs.</p>
560
<p>Note that <code>PYRO_CONFIG_FILE</code> is useless inside a configuration file. After initialization, it is
561
set to the absolute path of the configuration file that was used (or the empty string, if no configuration file
562
was used). Note that setting <code>PYRO_CONFIG_FILE</code> from within your code is useless too because Pyro is
563
already initialized at that point.</p>
565
</ol>Environment variables override configuration file settings. Configuration file settings override the built-in
568
<p><code>PYRO_STORAGE</code> is used at initialization time, that is, as soon as a part of the Pyro package is
569
imported in your program. You can only change <code>PYRO_STORAGE</code> <em>beforehand</em> by either setting the
570
environment variable or making an entry in the configuration file. Changing <code>Pyro.config.PYRO_STORAGE</code> in
571
your program leads to unexpected results, because the initilization has already been done using the old value. So
572
don't do this, and use one of the two other ways.</p>
577
<td align="left"><a href="2-concepts.html"><previous</a> | <a href="PyroManual.html">contents</a> | <a href=
578
"4-usage.html">next></a></td>
580
<td align="right">Pyro Manual</td>