Re: pyspi SpiException question



Marcin Lyko wrote:
Hi all,

I have a question about raising SpiException exceptions by Pyspi. Is it
okey that Pyspi raises SpiException (Non-fatal SPIException: type:0
source:0 "IDL:omg.org/CORBA/COMM_FAILURE:1.0) during call some method of
"gets" methods (getName, getRoleName, getComponent, etc) on an
accessible object of an application that has been already closed? A
refernce to the accessible object was taken before closing the application.
Here are example tracebacks:
$ ./spiexception.py
Traceback (most recent call last):
  File "./spiexception.py", line 23, in <module>
    scan_app(app)
  File "./spiexception.py", line 10, in scan_app
    app.getName()
  File "pyspi.pyx", line 463, in atspi.Accessible.getName
  File "pyspi.pyx", line 152, in atspi.exception_handler
atspi.SpiException: Non-fatal SPIException: type:0 source:0
"IDL:omg.org/CORBA/COMM_FAILURE:1.0"
~ $ ./spiexception.py
Traceback (most recent call last):
  File "./spiexception.py", line 23, in <module>
    scan_app(app)
  File "./spiexception.py", line 15, in scan_app
    app.getAction()
  File "pyspi.pyx", line 582, in atspi.Accessible.getAction
  File "pyspi.pyx", line 152, in atspi.exception_handler
atspi.SpiException: Non-fatal SPIException: type:0 source:0
"IDL:omg.org/CORBA/COMM_FAILURE:1.0"
~ $ ./spiexception.py
Traceback (most recent call last):
  File "./spiexception.py", line 23, in <module>
    scan_app(app)
  File "./spiexception.py", line 14, in scan_app
    app.getComponent()
  File "pyspi.pyx", line 666, in atspi.Accessible.getComponent
  File "pyspi.pyx", line 152, in atspi.exception_handler
atspi.SpiException: Non-fatal SPIException: type:0 source:0
"IDL:omg.org/CORBA/COMM_FAILURE:1.0"

These are normal and expected in the case where the application disappears out from under pyspi.

I run an application, next I run the spiexception.py, which takes
reference to the run application and calls getName, gatRoleName,
getAction, getComponent, etc methods and during running of the script I
close the application. Every time I get similar errors to these above.

IMHO, these situations are similar to a situation from the bug:
http://bugzilla.gnome.org/show_bug.cgi?id=468636
where the same exception was raised inside getChildAtIndex method. Since
fixing the bug, these exceptions are caught in the method in Pyspi and
the None object is returned instead. Maybe catching of exceptions should
be also add to others "gets" methods?

I think it's more appropriate to raise exceptions, since the situation is in fact "exceptional" - the methods you're calling assume a valid reference, but the reference is no longer valid. I think it's their duty to make it very clear what's happening :)

Also, note that pyspi has been obsoleted by pyatspi, the official python bindings for AT-SPI. pyatspi is in AT-SPI svn, and dogtail svn has been ported to it.

Zack

P.S. Please add my e-mail address to CC of every responses to this mail,
thanks in advance!

Best regards,
Marcin Lyko



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]