[BRLTTY] brlapi programming examples

Mika Hanhijärvi miksuh at gmail.com
Tue Aug 25 13:54:31 EDT 2020


Hello


Thanks. I did read the "pydoc3 brlapi" documentation and I tried this 
simple test:


#!/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)



If I understand it correctly that should work but when I run that I get 
this error:



Traceback (most recent call last):
   File "./test5.py", line 6, in <module>
     b.enterTtyMode()
   File "brlapi.pyx", line 446, in brlapi.Connection.enterTtyMode
brlapi.OperationError: <exception str() failed>




Am I missing something? Any idea what is wrong? I use Debi an 10 
"Buster" and I have installed brltty 6.0 packages from the Debian 
Buster's backports repository.







Samuel Thibault kirjoitti 24.8.2020 klo 17.33:
> Hello,
>
> Mika Hanhijärvi, le lun. 24 août 2020 17:25:58 +0300, a ecrit:
>> Could someone please tell me from where I can find some examples of how to
>> use brlapi in my own application or game?
> You have the documentation online
> https://brltty.app/doc/Manual-BrlAPI/English/BrlAPI.html
> and the doxygen documentation
> https://brltty.app/doc/BrlAPIref/index.html
>
> and you can find in the brltty source Programs/apitest.c or
> Programs/xbrlapi.c for C examples, and the head of "pydoc3 brlapi" which
> shows a python example.
>
> Samuel
> _______________________________________________
> This message was sent via the BRLTTY mailing list.
> To post a message, send an e-mail to: BRLTTY at brltty.app
> For general information, go to: http://brltty.app/mailman/listinfo/brltty


More information about the BRLTTY mailing list