Exception from pyd methods

dieter dieter at handshake.de
Sat Mar 19 04:31:17 EDT 2016


Palpandi <palpandi111 at gmail.com> writes:
> I am using methods from pyd files. At some cases, it is throwing some error messages in the console.
>
> When I use try.. except.. I am getting only the exception name.
> Not able to catch the entire error message.
>
> How do I get the the entire error message printed in the console?

You may have no chance: "*.pyd" files usually contain functions
defined in "C". If the author of such a function decided to print
a message rather than put it into an exception, then it may be difficult
to get at the message.

If the function author write the message to "sys.stderr" or
"sys.stdout" with standard Python file operations, then you
might be able to get at the message by replacing "sys.stderr/out"
with a file object of your own. But this is first not sure and
second very nasty.




More information about the Python-list mailing list