<previous | top | next> | Pyro Manual |
Installation
Extract the Pyro archive. It has five subdirectories:
Pyro/
lib/site-python
directory is a nice place. On Windows, move
it in the Python folder itself.PYTHONPATH
).bin/
docs/
and examples/
extra/
SocketServer.py
' is
in here. This is the Python 1.5.2 version of the SocketServer
module. Pyro requires this version so if you don't already use Python 1.5.2,
make sure this newer (and bugfixed) SocketServer.py
is used, for
instance, by copying it over the old version in the Python library directory.Configuration
The default settings will do nicely in most cases. But sooner or later you will have to change some parameters of Pyro.
Pyro's configuration is accessed through Pyro.config
. This object has several configuration items:
Configuration item | Type | Description | Default value |
---|---|---|---|
PYRO_CONFIG_FILE
| string | The Pyro configuration file that is used. See below. | Special, see below |
PYRO_STORAGE
| string | Location where Pyro stores data like log files. | Current directory |
PYRO_LOGFILE
| string | Name of the logfile. If it's not an absolute path, it's relative to $PYRO_STORAGE .
| Pyro_log |
PYRO_USER_LOGFILE
| string | Name of the user logfile. If it's not an absolute path, it's relative to $PYRO_STORAGE .
| Pyro_userlog |
PYRO_TRACELEVEL
| number | The tracing level of Pyro, 0-3. 0=nothing, 1=only errors, 2=warnings too, 3=full: errors, warnings and notes. | 0 |
PYRO_USER_TRACELEVEL
| number | The user tracing level, 0-3. 0=nothing, 1=only errors, 2=warnings too, 3=full: errors, warnings and notes. | 0 |
PYRO_BINARY_PICKLE
| boolean | Wether the default marshaling is done in binary format (faster and less memory usage) or in human-readable ASCII. | 1 |
PYRO_COMPRESSION
| boolean | Wether the protocol should compress the data to save bandwidth (at the cost of CPU time).
The zlib module is used for compression. If you don't have zlib , Pyro still works, but without compression.
| 0 |
PYRO_MAXCONNECTIONS
| number | 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. | 200 |
PYRO_MULTITHREADED
| boolean | Wether Pyro servers should be multithreaded or not. | 1 (if supported) |
PYRO_MOBILE_CODE
| boolean | Wether Pyro should automatically download Python code from clients if it isn't available on the server. | 0 |
PYRO_DNS_URI
| boolean | Wether symbolic DNS host names should be used in URIs instead of fixed IP addresses. | 0 |
PYRO_BC_RETRIES
| number | How often a broadcast will be retried if no answer has been received. Currently only used by the Name Server locator. | 2 |
PYRO_BC_TIMEOUT
| number | How long Pyro will wait (in seconds) for an answer to a broadcast request. Currently only used by the Name Server locator. | 2 |
PYRO_PORT
| number | The base socket number of the range of socket numbers that the Pyro daemon can use to listen for incoming requests (Pyro method calls). | 7766 |
PYRO_PORT_RANGE
| number | The size of the socket port range. Pyro will try connections in the range PYRO_PORT to PYRO_PORT+PYRO_PORT_RANGE. | 100 |
PYRO_NS_NAME
| string | The readable object name of the Pyro Naming Server objects. Note: this option cannot be changed by an environment variable. | :Pyro.NameServer |
PYRO_NS_GROUPSEP
| char | The character that is used to separate groups in names. Note: can't be changed after init. And please make sure it is different from PYRO_NS_ROOTCHAR .
Strange things happen if the Naming Service uses another character than your code does.
| .
|
PYRO_NS_ROOTCHAR
| char | The character at the beginning of names to make them absolute from the root namespace. Note: can't be changed after init. And please make sure it is different from PYRO_NS_GROUPSEP .
Strange things happen if the Naming Service uses another character than your code does.
| :
|
PYRO_NS_DEFAULTGROUP
| string | The default group name in which names are located. This must be an absolute name (starting with the root character). | :Default
|
PYRO_NS_URIFILE
| string | The file where the Naming Server will write its URI. If it's not an absolute path, it's relative to $PYRO_STORAGE .
| Pyro_NS_URI
|
PYRO_NS_BC_PORT
| number | The socket number on which the Naming Server will listen for broadcast requests (usually to find the location). | 9091 |
PYRO_NS_PORT
| number | The socket number on which the Naming Server will listen for incoming requests (Pyro method calls, in fact). | 9090 |
Pyro.config.PYRO_PORT = 7000
Pyro.config.PYRO_TRACELEVEL = 3
PYRO_NS_NAME
, 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:$ export PYRO_LOGFILE=/var/log/PYRO/logfile
$ export PYRO_TRACELEVEL=3
PYRO_NS_NAME
cannot be configured this way.)
PYRO_CONFIG_FILE
is set. If it isn't set, or set to an empty string, Pyro checks for a Pyro.conf
file in the current directory.
If it exists, Pyro uses it as a configuration file. If it doesn't exist, Pyro uses the default built-in configuration.
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. 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.
Note that you can change PYRO_NS_NAME
in a configuration file!
Note that PYRO_CONFIG_FILE
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).
Note that setting PYRO_CONFIG_FILE
from within your code is useless too because Pyro is already initialized at that point.