Using the Python Console in NVDA


Bob Cavanaugh
 

Hi all,
This topic may be more suited to the development list, but as I'm not
a developer, there's no reason for me to subscribe at this time. I may
ask there though if it requires a discussion that goes too far into
the weeds though. What is the purpose of the Python Console in NVDA?
I'm learning Python this quarter, but am currently not sure how if at
all, any of it applies to NVDA.
Also, could any totally blind developers email me offlist? I'm curious
how you tell whether your indentation is correct.
Bob


Abdulqadir Ahmad
 

Sorry, the first mail was a mistake.
With that out of the way, i want to talk about two things. The NVDA python console and python's indentation.
As for the NVDA python console, i use it as an environment to test NVDA scripts. There are some NVDA modules(files) that you'll have to import when writing NVDA scripts. E.g ui. You can't just open the normal python console and import it. You'll have to tell python where to find it or you wil get an error. Try typing these two lines in both the normal python console and NVDA python consol:
import ui
ui.message("Hello NVDA world")
As for indentation, you have two options. Manually check it or turn on NVDA indentation speak settings. You can manually check it by taking the cursor to the beginning of the line and counting the space or tab characters there. I am not sure where the settings is and I am not close to my laptop but I know nvda has a settings that would let you know when the indentation of what you are reading using your cursor have changed.


Brian's Mail list account
 

The question is, though, what does the average user use it for? I remember being told to paste some scripts in to help diagnose an issue, but other than a vague understanding of how the script affected the Nvda normal code. I see no real use without the knowledge of Python and the NVDA software itself. Being compiled, it seems you are only able to affect some temporary changes.
Brian

--
bglists@...
Sent via blueyonder.(Virgin media)
Please address personal E-mail to:-
briang1@..., putting 'Brian Gaff'
in the display name field.

----- Original Message -----
From: "Abdulqadir Ahmad" <2004a3abuahmad@...>
To: <nvda@nvda.groups.io>
Sent: Sunday, February 05, 2023 5:32 AM
Subject: Re: [nvda] using the Python consol in NVDA


Sorry, the first mail was a mistake.
With that out of the way, i want to talk about two things. The NVDA python
console and python's indentation.
As for the NVDA python console, i use it as an environment to test NVDA
scripts. There are some NVDA modules(files) that you'll have to import when
writing NVDA scripts. E.g ui. You can't just open the normal python console
and import it. You'll have to tell python where to find it or you wil get
an error. Try typing these two lines in both the normal python console and
NVDA python consol:
import ui
ui.message("Hello NVDA world")
As for indentation, you have two options. Manually check it or turn on NVDA
indentation speak settings. You can manually check it by taking the cursor
to the beginning of the line and counting the space or tab characters
there. I am not sure where the settings is and I am not close to my laptop
but I know nvda has a settings that would let you know when the indentation
of what you are reading using your cursor have changed.





Luke Davis
 

Brian's Mail list account via groups.io wrote:

The question is, though, what does the average user use it for?
The average user doesn't.
I would suspect that most never even know it's there, except for an odd command in the list. I'm not actually sure why that command is mapped by default.

I remember being told to paste some scripts in to help diagnose an issue, but other than a vague understanding of how the script affected the Nvda normal code. I see no real use without the knowledge of Python and the NVDA software itself. Being compiled, it seems you are only able to affect some temporary changes.
All basically true. You can do things that will save, such as messing with configuration variables, but for the most part, except as a diagnostic tool, the average user will never use it.

Programmers may, for quickly and easily testing out things in the NVDA environment, when writing add-ons and such.

Luke


alexey
 

 The question is, though, what does the average user use it for?
My friends use it as a quick calculator for dividing, multiplying, adding or subtracting numbers.
According to the keyboard shortcut, it turns out very, very quickly.


Cyrille
 

Hello

Average users do not have to use it.
The only exception may be when instructed by a developer to do something.

I remember in the past an issue with NVDA update unable to proceed due to a certificate issue. Joseph had sent one or two command lines to copy/paste in the console to work around this issue.

Cheers,

Cyrille


Sarah k Alawami
 

I've used the consul for calculations. I know I could have used the
calculator, but I chose to write it in the consul and convert stuff that
way. I was at the time board.

-----Original Message-----
From: nvda@nvda.groups.io <nvda@nvda.groups.io> On Behalf Of Luke Davis
Sent: Sunday, February 5, 2023 6:43 AM
To: nvda@nvda.groups.io
Subject: Re: [nvda] Using the Python Console in NVDA

Brian's Mail list account via groups.io wrote:

The question is, though, what does the average user use it for?
The average user doesn't.
I would suspect that most never even know it's there, except for an odd
command in the list. I'm not actually sure why that command is mapped by
default.

I remember being told to paste some scripts in to help diagnose an
issue, but other than a vague understanding of how the script affected
the Nvda normal code.
I see no real use without the knowledge of Python and the NVDA
software itself. Being compiled, it seems you are only able to affect
some temporary changes.
All basically true. You can do things that will save, such as messing with
configuration variables, but for the most part, except as a diagnostic tool,
the average user will never use it.

Programmers may, for quickly and easily testing out things in the NVDA
environment, when writing add-ons and such.

Luke









--
----------

Sarah Alawami, owner of flying Blind. Visit my website ( http://flyingblind.us ) to read my story.

Windows 11 22H2 (x64) build 22621.963
NVDA Version: 2022.3.3

Microsoft 365 MSO (Version 2211 Build 16.0.15831.20098) 64-bit


 

As has become abundantly clear, while there are some "creative ways" for an NVDA end user to employ the Python Console, it's really not intended for end users as a part of day to day use.  Not unlike debugging options under Android, which an end user can turn on, but very few do because they're not something for common, everyday use.

The NVDA Python Console is a convenient backdoor of sorts when an NVDA developer or add-on developer is working with an end user to debug something, or is working themselves developing something.  That's still clearly not an end user tool in any meaningful sense of the phrase.
--

Brian Virginia, USA Windows 11 Pro, 64-Bit, Version 22H2, Build 22621; Office 2016, Version 16.0.15726.20188, 32-bit

It is much easier to be critical than to be correct.

       ~ Benjamin Disraeli, 1804-1881


 

Hi all,

The Python Console (equivalent somewhat to JAWS scripting utility for folks coming from that world) is designed mostly for use by developers to test code and/or investigate accessibility issues and objects. I use it whenever I need to validate an algorithm or two before incorporating them into add-ons and/or NVDA screen reader pull requests. There is a proposal somewhere (perhaps raised on Twitter (I might add: before it went downhill)) to remove Python Console from NVDA and make it into an add-on to improve security (as Python Console is in fact an interpreter with a read-evaluate-print loop or REPL, it can perform anything you want by writing in Python, including modifying files and folders, more so if invoked from an installed copy of NVDA).

Cheers,

oseph


Bob Cavanaugh
 

Thanks Joseph and all for your responses. Joseph, I've thought about
taking over development of one of your addons once this quarter is
over, but I'm not sure I will have the skills to do so. I'll write you
when that happens, which will be in about six weeks. The main reason I
asked the question was because I tried running a program I had written
in there last week and got a bunch of errors. It wouldn't hurt my
feelings at all if Python Console is removed from NVDA core and became
an addon.

On 2/5/23, Joseph Lee <joseph.lee22590@...> wrote:
Hi all,

The Python Console (equivalent somewhat to JAWS scripting utility for folks
coming from that world) is designed mostly for use by developers to test
code and/or investigate accessibility issues and objects. I use it whenever
I need to validate an algorithm or two before incorporating them into
add-ons and/or NVDA screen reader pull requests. There is a proposal
somewhere (perhaps raised on Twitter (I might add: before it went downhill))
to remove Python Console from NVDA and make it into an add-on to improve
security (as Python Console is in fact an interpreter with a
read-evaluate-print loop or REPL, it can perform anything you want by
writing in Python, including modifying files and folders, more so if invoked
from an installed copy of NVDA).

Cheers,

oseph






Dave Grossoehme
 

I am not sure the question was answered for the original message on this subject.  It's possible Joseph is the one to answer it or someone else knowledgeabnle of Python.  The original question was how to tell using NVDA as to how if you have the correct number of spaces for a paragraph, and if there was away to tell this using NVDA.  Or is this a question the person needs to take to another NVDA email list?  I don't mean to extend this subject, but I didn't see a response for this sender.  If there was an answer I apologize to everybody for reaching out on a limb here.

Dave


On 2/5/2023 12:49 PM, Joseph Lee wrote:

Hi all,

The Python Console (equivalent somewhat to JAWS scripting utility for folks coming from that world) is designed mostly for use by developers to test code and/or investigate accessibility issues and objects. I use it whenever I need to validate an algorithm or two before incorporating them into add-ons and/or NVDA screen reader pull requests. There is a proposal somewhere (perhaps raised on Twitter (I might add: before it went downhill)) to remove Python Console from NVDA and make it into an add-on to improve security (as Python Console is in fact an interpreter with a read-evaluate-print loop or REPL, it can perform anything you want by writing in Python, including modifying files and folders, more so if invoked from an installed copy of NVDA).

Cheers,

oseph


 

On Tue, Feb 7, 2023 at 11:22 AM, Dave Grossoehme wrote:
The original question was how to tell using NVDA as to how if you have the correct number of spaces for a paragraph, and if there was away to tell this using NVDA. 
-
Uh, no, it wasn't.  See the original post:  

What you're recalling was in a follow-up message.

The Python Console in NVDA is much more a diagnostic and troubleshooting tool when NVDA or Add-On developers need to try some "quick and dirty" diagnostics and/or fixes.  It really doesn't have a daily driver use for your typical NVDA user.
--

Brian Virginia, USA Windows 11 Pro, 64-Bit, Version 22H2, Build 22621; Office 2016, Version 16.0.15726.20188, 32-bit

It is much easier to be critical than to be correct.

       ~ Benjamin Disraeli, 1804-1881


Bob Cavanaugh
 

Dave isn't entirely wrong as I did also ask about how to tell about
indentation, but yes, the main question was about the use of the
console.

On 2/7/23, Brian Vogel <britechguy@...> wrote:
On Tue, Feb 7, 2023 at 11:22 AM, Dave Grossoehme wrote:


The original question was how to tell using NVDA as to how if you have
the
correct number of spaces for a paragraph, and if there was away to tell
this using NVDA.
-
Uh, no, it wasn't.  See the original post: #103333 (
https://nvda.groups.io/g/nvda/message/103333 )

What you're recalling was in a follow-up message.

The Python Console in NVDA is much more a diagnostic and troubleshooting
tool when NVDA or Add-On developers need to try some "quick and dirty"
diagnostics and/or fixes.  It really doesn't have a daily driver use for
your typical NVDA user.
--

Brian - Virginia, USA - Windows 11 Pro, 64-Bit, Version 22H2, Build 22621;
Office 2016, Version 16.0.15726.20188, 32-bit

*It is much easier to be critical than to be correct.*

~ Benjamin Disraeli, 1804-1881






Abdulqadir Ahmad
 

I have slightly spoke about the indentation part. That was the first message in the thread. At that time, I wasn't near my laptop. So, let me update somethings I said.

As I said earlier, you can manually do it or let NVDA do it for you. To let NVDA do it, open the NVDA menu (NVDA key + n) and do:

1. Click preferences, then click settings.

2. Scroll down to Document formatting
3. Tab to line indentation reporting.

You have 3 options there. Try out each and select which one you like the most.