question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running a name server:

python -m Pyro4.naming

Having the following server.py:

import Pyro4


class Test(object):
    def test(self):
        return int('a')


if __name__ == '__main__':

    daemon = Pyro4.Daemon()
    ns = Pyro4.locateNS()
    uri = daemon.register(Test)
    ns.register("test", uri)

    print("Ready.")
    daemon.requestLoop()

And having the following client.py:

import Pyro4


if __name__ == '__main__':

    proxy = Pyro4.Proxy("PYRONAME:test")
    proxy.test()

This code basically ends up executing int('a'), which in Python should raise:

ValueError: invalid literal for int() with base 10: 'a'

The ValueError is raised when running client.py, however, the traceback looks like this:

Traceback (most recent call last):
  File "client.py", line 7, in <module>
    proxy.test()
  File "/home/peque/.miniconda3/envs/pyro4/lib/python3.5/site-packages/Pyro4/core.py", line 172, in __call__
    return self.__send(self.__name, args, kwargs)
  File "/home/peque/.miniconda3/envs/pyro4/lib/python3.5/site-packages/Pyro4/core.py", line 427, in _pyroInvoke
    raise data
ValueError: invalid literal for int() with base 10: 'a'

Note that client.py:7; proxy.test() is represented, but there is no reference to server.py:6; return int('a'), which is the line in which the exception actually occurred.

Am I missing something or is this actually not supposed to happen?

Thanks for your help. 😊

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
irmencommented, Feb 18, 2019

@gst it is convenient I agree, but consider the arguments on the table already. Pyro is a generic library and as such it should not print arbitrary messages or interfere with global Python errorhandling. If you want this, you should do it in your application code itself. Pyro provides some tools (the exception hook in util, the getPyroTraceback method or the possibility to create your own proxy subclass to customize the behavior like what Peque showed above) to make this easier if your code wants it, but ultimately, it leaves it up to you to enable them in your own client application code.

0reactions
irmencommented, Mar 2, 2019

@gst that’s because the exception is raised on the local side (it’s your local client code that encountered an error). This is what would happen if you were doing a normal python function call, and Pyro doesn’t interfere with that. The special thing about Pyro is that there is a remote party involved, hence the special method / exception hook to retrieve that additional part of the error

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding the Python Traceback
You'll walk through several examples of tracebacks and see some of the most common ... line of the NameError traceback gives you the...
Read more >
traceback — Print or retrieve a stack traceback — Python 3.11 ...
This module provides a standard interface to extract, format and print stack traces of Python programs. It exactly mimics the behavior of the...
Read more >
Exception traceback is hidden if not re-raised immediately
The original traceback is lost. How can I preserve original traceback and re-raise it? I want to see something similar to this: Traceback...
Read more >
Exceptions and remote tracebacks — Pyro 5.14 documentation
Since the error occurred in a remote object, and Pyro itself raises it again on the client side, some information is initially lost:...
Read more >
Traceback missing · Issue #173 · hynek/structlog - GitHub
Logs a message with level ERROR on this logger. The arguments are interpreted as for debug(), except that any passed exc_info is not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found