[BRLTTY] Python 3 brlapi?
Samuel Thibault
samuel.thibault at ens-lyon.org
Thu Oct 25 12:47:44 EDT 2012
Hello,
Hammer Attila, le Thu 25 Oct 2012 09:07:11 +0200, a écrit :
> In Ubuntu Quantal stable release Orca drops following traceback messages a
> debug.out file when I want using native braille support with Brltty
> 4.4-5ubuntu3 default shipped package version:
I've just tried this with python3 support, and it does work nice.
> BrlTTY seems to have disappeared:
> Traceback (most recent call last):
> File "/usr/lib/python3/dist-packages/orca/braille.py", line 1717, in
> _brlAPIKeyReader
> key = _brlAPI.readKey(False)
> File "brlapi.pyx", line 535, in brlapi.Connection.readKey
> (brlapi.auto.c:6563)
> brlapi.OperationError: <unprintable OperationError object>
Damn, python3's switch to unicode string apparently makes it
unreadable. Could you try to run the attached script?
> If I ran python3 command and try import brlapi with import brlapi code line,
> I not see any error message.
The brlapi.key reading happens after that, in the Connection() call.
Samuel
-------------- next part --------------
#!/usr/bin/python3
import brlapi
try:
b = brlapi.Connection()
b.enterTtyMode()
except brlapi.ConnectionError as e:
if e.brlerrno == brlapi.ERROR_CONNREFUSED:
print("Connection to %s refused. BRLTTY is too busy..." % e.host)
elif e.brlerrno == brlapi.ERROR_AUTHENTICATION:
print("Authentication with %s failed. Please check the permissions of %s" % (e.host,e.auth))
elif e.brlerrno == brlapi.ERROR_LIBCERR and (e.libcerrno == errno.ECONNREFUSED or e.libcerrno == errno.ENOENT):
print("Connection to %s failed. Is BRLTTY really running?" % (e.host))
else:
print("Connection to BRLTTY at %s failed: " % (e.host))
print(e)
print(e.brlerrno)
print(e.libcerrno)
More information about the BRLTTY
mailing list