The Troubleshooting section provides various hints and tips when you can't get things to work as expected.
The Specific issues section at the end contains more detailed discussion of specific issues you may encounter:
util.getPyroTraceback
function for instance.PYRO_DETAILED_TRACEBACK
config item. This one is disabled
by default because of security reasons.sys.excepthook
to automatically print any remote
exception tracebacks that might be part of an exception. The hook is provided as Pyro.util.excepthook
.OSError
-- is raised when Pyro needs but can't create or open the
storage directory specified by PYRO_STORAGE
.
NamingError
-- The Name Server raises a NamingError
exception (raised by the remote NS object) if an error condition occurs. It usually has a detailed
error description in the args
attribute. That is a tuple of one or two elements. The first
element is the error string (such as "name not found") and the second (if present) is the offending
name.
PyroError
-- The NameServerLocator
raises PyroError
"Name
Server not responding" if it failed to discover the Name Server (via the getNS
method).
Also, the PYROAdapter
raises NoModuleError
"No module named XYZ" if
it cannot import a Python module. See below in the table.
Also, the startup code in configuration.py
raises PyroError
"Error reading
config file"
if Pyro's configuration file cannot be read.
URIError
-- The PyroURI
object raises
URIError
"illegal URI format" when you try to create a PyroURI
object
from an illegal URI. Also "unknown host" means that you supplied an unknown hostname or IP address
for the URI.
DaemonError
-- The Daemon
object raises DaemonError
"Couldn't start Pyro daemon" if it was unable to start. This usually means that the required network
port (socket) is temporarily unavailable because another Pyro daemon is already running on it.
Exception | Error string | raised by | description |
---|---|---|---|
ConnectionClosedError |
connection lost | receive code | The network connection was lost while receiving data. |
ConnectionClosedError |
connection lost | send code | The network connection was lost while sending data. |
ProtocolError |
incompatible protocol in URI | bindToURI method of PYROAdapter |
You supplied an incompatible protocol ID. Use 'PYRO'. |
ProtocolError |
connection failed | bindToURI method of PYROAdapter |
Network problems caused the connection to fail. Also the Pyro server may have crashed. |
ProtocolError |
invalid header | receive code | A message with an invalid header has been received. |
ProtocolError |
incompatible version | receive code | A message from an incompatible Pyro version has been received. |
ProtocolError |
unsupported protocol | getProtocolAdapter |
You tried to get a protocol adapter for an unsupported protocol. Currently only the 'PYRO' protocol is supported. |
ProtocolError |
compression not supported | receive code | An incoming message used compression, which this Pyro setup doesn't support (most likely you don't have the
zlib module). |
ProtocolError |
unknown object ID | receive code | Incoming method call for an unknown object (i.e. the object ID was not found in the Daemon's list of active objects). |
NoModuleError |
No module named XYZ | remote method call code | The Pyro server cannot import the Python module XYZ that contains the code for an object that was passed in a
remote call. If you don't use mobile code, the Pyro server must have all .py files available. |
PyroError |
attempt to supply code denied | remote method call code | Either a client tried to submit code to a server that hasn't enabled mobile code, or the server had enabled mobile code but the codeValidator refused to accept it. |
ConnectionDeniedError |
unspecified reason | bindToURI method of PYROAdapter |
No specific reason given for denying the connection |
ConnectionDeniedError |
server too busy | bindToURI method of PYROAdapter |
The Pyro server has too many connections at this time so your request for another connection was denied. |
ConnectionDeniedError |
host blocked | bindToURI method of PYROAdapter |
The server blocks your host/IP address. |
ConnectionDeniedError |
security reasons | bindToURI method of PYROAdapter |
General security issue prevented a connection. |
TimeoutError |
connection timeout | while transferring data in PyroAdapter | The communication took longer that the timeout perioud that was specified. (default: off) |
KeyError
-- The ArgParser
will raise KeyError
"no
such option" if you try to getOpt
an option that has not been detected in the option
string and you have not supplied a default value to getOpt
(otherwise that default value
is returned).
Use python -m Pyro.configuration
to get a printout of Pyro's active configuration settings.
Problem | Possible cause | Hint/tip |
---|---|---|
The Name Server or my own Pyro server refuses to start, aborts with DaemonError |
The daemon can't set up the network port (socket), probably because another daemon is already running, or another process occupies the resource. |
Wait a little while and try again (sometimes it takes a while for resources to become available again). If this
doesn't work, find the other daemon that is probably running and shut it down, or specify another port for the
new daemon. Sorry, but your new process can't yet use the daemon of another running process - perhaps in a
future Pyro version.
It could also be that there is something special about your network setup, like: multiple NICs / IP addresses on a single host. Please read the "Features and Guidelines" chapter. |
Name Server acts weird with names or groups | not using built-in static NS proxy | always use the Pyro.naming.NameServerProxy returned by the Name Server Locator. |
Pyro refuses to initialize, aborts with IOError and/or things saying 'permission denied' or
similar |
You probably specified a wrong location for Pyro's storage directory and/or logfiles. Perhaps you don't have permission to write in those locations. | Fix those locations by changing the configuration items. Make sure you have permission to write to those
locations. Usually PYRO_STORAGE must be changed to point to a correct directory. |
My code can't find the Name Server, it aborts with "Name Server not responding" | The Pyro Name Server is not running or it can't be discovered automatically. The latter may be the case if your network doesn't support broadcasts or if the NS is running on a different subnet that cannot be reached by a broadcast. | Start the NS if it's not running. If the problem persists, you have to help the
NameServerLocator by specifying the host and perhaps even the port number where the NS is running.
You can also try to obtain the NS' URI string and create a proxy directly from this string, bypassing the
NameServerLocator . |
Still can't contact Name Server or my Pyro objects, but NS is active. Log has warning about local address 127.0.0.1. | NS or daemon binds on loopback address due to faulty network config. | Look at the specific issues at the bottom for a discussion about this problem. |
'name not absolute' errors after changing default namespace group. | The default group name for the PYRO_NS_DEFAULTGROUP config item must be an absolute
name (starting with the root char). |
Change it to an absolute name. |
Client can't bind to URI or find URI in Name Server. NS is running ok, server is running ok. | The URI is not registered correctly in the Name Server. | Make sure that the client accesses the correct Name Server (the one that the server used to register the object), especially if you're running multiple NS. Also make sure that the client uses the correct URI. |
Client problems when accessing Pyro object attributes, client prints stuff like <bound method
DynamicProxy._invokePYRO of DynamicProxy ... > instead of attribute value |
You are using regular dynamic proxy | Use attribute enabled proxy; see getAttrProxyForURI . |
Client crashes with "No module named ..." or similar when accessing attributes | The attribute object is an instance of a class that cannot be found/imported on the client | make the module that contains every attribute class available on the client, or write getters. |
Pyro doesn't use my configuration settings! | Other settings overrule your settings. | Check if there is an environment variable that overrules your config file, or perhaps even a setting in your code.. |
Pyro object doesn't initialise correctly | Pyro objects cannot have a remote __init__ method | Use explicit remote initialization by using a custom init method.. |
General network errors when using firewall or multiple network adapters (can't find NS, Pyro uses wrong IP address in URIs) | Firewalls need special treatment | Read the chapter Features and Guidelines. |
Client cannot connect anymore after restarting the server | Pyro URIs change every time the server is restarted, and the client uses an old URI | update the URI on the client, or use the Name Server, or use Persistent Naming. |
Deadlock (Pyro freezes) | Callback waits for other object (occurs in 'conversation' or 'looping' invocation) | Make sure your Daemon is running in multithreaded mode. Also consider using Oneway invocations or the Event Server. |
Pyro Object created on server and returned to client doesn't work | You are probably not returning a proxy but the object itself. | Return a proxy instead: return Obj.getAttrProxy() |
PicklingError or TypeError: can't pickle .... objects | You're passing an unpickleable object to Pyro | Remove any nonpickleable objects. You might want to try custom __getstate__ and
__setstate__ methods. |
Other PicklingErrors or 'invalid load key' or other vague errors | Incompatilbe Python version or version mismatch | You need at least Python 2.3 or newer, and you need the same major Python version everywhere. Otherwise the pickle protocol datastream is incompatible. |
Syntax Error exception when using mobile code | Pyro couldn't compile the downloaded code | It could be that you have old *.pyc or *.pyo files around from a different Python version. Remove these files. If not, your source has a true syntax error in it, try to import it standalone and see if it works. |
PyroError 'server wanted a non-existing module' when using mobile code | You're probably importing other modules from within your mobile agent module, using a relative package/module name | When you import other modules from your mobile object, you have to use the fully qualified module name. Using a package local module name doesn't work. See the agent3 example. |
Other problem not mentioned here | Your code probably breaks a Pyro rule | read the the chapter Features and Guidelines. |
SSL problems | ? | Sorry, I don't know much about SSL. Ask on Usenet or the mailing list. |
Trouble using object.attr.subattr.subsubattr or calling 'nested' methods like
obj.address.getStreet() |
All classes that are used for the nested attributes must be available on the client. | See the "attributes" example. |
Troubles with floating point numbers such as INF or NaN. | Python's use of these numbers isn't standardized, and they cannot be pickled/unpickled. | Python 2.5 contains some fixes for this issue. Might not work on Windows though. |
Pyro crashes. | Most likely a bug. | Try to find some help on the mailing list. |
Sometimes you may encounter a problem with connecting to your Pyro server over the network, and Pyro complains that it cannot connect to your server. If you see some complaints about '127.0.0.1', 'localhost' or 'loopback adapter' in the error or in the log, continue reading.
What is happening? Pyro has connected the server to 127.0.0.1 which is the local loopback network. This means that the server is not accessible from anything but the local host. Pyro code on a different host can never make a connection to this server because even if it obtains an URI from the server, the address in it will be 127.0.0.1 and that means: 'hey, I am on your local host'. It then tries to connect to the server on the local host, but that won't work for obvious reasons.
Why is this happening?
You may have told Pyro to use the loopback address yourself, by setting the hostname to bind on to 'localhost' or '127.0.0.1'.
That is fine as long as you're only running stuff on this single host, but if external machines try to connect to it
it will fail.
The other explanation is that the hostname Pyro uses to bind the server on, resolves (via DNS) to the IP address
of the loopback adapter (127.0.0.1).
Quite a few Linux distributions are set up like this unfortunately, where the hostname of your computer resolves to 127.0.0.1.
(you can usually check this by typing ping yourhostname
at a shell prompt).
When Pyro tries to bind the server to a network adapter, it is then likely it ends up with 127.0.0.1.
What can I do about it? There are several options to fix this problem:
daemon=Pyro.core.Daemon(host="my.external.ip.address")
PYRO_HOST
PYRO_DNS_URI
PYRO_PUBLISHHOST
PYRO_NS_HOSTNAME
/etc/hosts
file on your system and fix the IP address that's associated with your hostnameIn Python 2.5 and later, there is an issue with user-defined exceptions. Say you have a custom exception class written as follows:
class MyEx(Exception): def __init__(self, mymessage): self.mymessage=mymessage def __str__(self): return "[MyEx '%s']" % self.mymessage
If you are passing these exceptions over the wire in Pyro method calls, you will find that your program crashes with an error like this:
TypeError: ('__init__() takes exactly 2 arguments (1 given)', <class '__main__.MyEx'>, ())
This is not Pyro's fault: it is caused by a change in the Exception classes which was introduced in Python 2.5.
This change seems to cause that Exception objects don't follow the usual pickle protocol.
The unpickling of the exception object fails, because the __init__
method is called without any arguments
(it shouldn't even be called at all by the way!).
Unfortunately, you won't be able to fix this problem by writing a __getinitargs__
or __getnewargs__
method to force the correct parameters, because these methods won't be called.
The easiest way to work around this problem now seems to change the init method so that it uses *args
instead of a single argument (this is what the built in Exceptions seem to do), or change it a little so that it also works with zero arguments:
def __init__(self, mymessage=None): self.mymessage=mymessage
If you don't need any special behavior of your own exception objects, it is probably best to just subclass them from Exception and not define any custom methods or properties. That avoids the problem as well. All builtin exceptions should accept a string argument to be used as the exception message, so there is no need to subclass the exception and add custom behavior as shown above, if you just want to remember a message string.