Python pring function with flush=True NVDA not reading the updated messages in Windows PowerShell


Ken Perry
 

I tried running your code and it has errors. Can you try your code and make sure it works before you send it? Note things like the range function in the for loop and the sec variable is what I am talking bout.

-----Original Message-----
From: nvda@nvda.groups.io <nvda@nvda.groups.io> On Behalf Of William
Sent: Saturday, May 14, 2022 5:04 AM
To: nvda@nvda.groups.io
Subject: [nvda] Python pring function with flush=True NVDA not reading the updated messages in Windows PowerShell

Hello,

This question is partly related to NVDA and partly related to Windows PowerShell.


Supposed I have the following python script and stored in a python file
'test.py', which print out a new string of text after every second.


import time

for i in np.arange(10):

print('Sleeping', f"{str(round((i-1)/secs*100,
0)).removesuffix('.0')}%", end="\r", flush=True)

time.sleep(1)

1. I open Windows PowerShell

2. type python test.py

3. the script starts running

I am expecting that NVDA can automatically speak out the new string of
text, but in my test, after the first 'Spleeping...' was spoken, NVDA
did not speak the updated messages.


What can I do to make NVDA speak the updated messages? Thanks.

William


Gabriele Battaglia
 


Reply to William's message, wrote on 16/05/2022 at 12:10:
>do you have an example?

I'm not able to reproduce it at the moment. I tried this and it works.


#test
import time
for i in range(4):
  print(f"\nThis is number {i}",end="")
  time.sleep(0.8)
Could you please show me once more the piece of code you posted at the beginning?
Thanks.


William
 

Hi


Do you have the same issue also if you print a return, \n, after the
value?


do you have an example?


Gabriele Battaglia via groups.io 於 16/5/2022 17:45 寫道:

Reply to William's message, wrote on 16/05/2022 at 11:26:
Hi Gabe.

I just posted this question in nvda-dev but so far I have not received any feedback.

Ops. I hope someone answer later.

Do you have the same issue also if you print a return, \n, after the value?

Gabe.





Gabriele Battaglia
 

FYI

Powershell is not involved itself. It's matter of all console app.

I don't use Powershell but I have the same issue on command prompt.

Gabe.


Gabriele Battaglia
 

Reply to William's message, wrote on 16/05/2022 at 11:26:
Hi Gabe.

I just posted this question in nvda-dev but so far I have not received any feedback.

Ops. I hope someone answer later.

Do you have the same issue also if you print a return, \n, after the value?

Gabe.


William
 

Hi Gabe.

I just posted this question in nvda-dev but so far I have not received any feedback.



Gabriele Battaglia via groups.io 於 16/5/2022 16:51 寫道:

Hi William.

I just joined the dev's group but I'm asking if you already posted this question there and if you got some answers.

I'm very interested in this topic because I have this issue also.

Thanks.


Gabe.





Gabriele Battaglia
 

Hi William.

I just joined the dev's group but I'm asking if you already posted this question there and if you got some answers.

I'm very interested in this topic because I have this issue also.

Thanks.


Gabe.


William
 

Noted, thanks.

Quentin Christensen 於 16/5/2022 11:22 寫道:

Hi William,

You might get more responses for these Python questions in the NVDA developer group: https://groups.io/g/nvda-devel

Kind regards

Quentin.

On Sat, May 14, 2022 at 7:04 PM William <xsuper.sillyx@...> wrote:
Hello,

This question is partly related to NVDA and partly related to Windows
PowerShell.


Supposed I have the following python script and stored in a python file
'test.py', which print out a new string of text after every second.


import time

for i in np.arange(10):

     print('Sleeping', f"{str(round((i-1)/secs*100,
0)).removesuffix('.0')}%", end="\r", flush=True)

     time.sleep(1)

1. I open Windows PowerShell

2. type python test.py

3. the script starts running

I am expecting that NVDA can automatically speak out the new string of
text, but in my test, after the first 'Spleeping...' was spoken, NVDA
did not speak the updated messages.


What can I do to make NVDA speak the updated messages? Thanks.

William











--
Quentin Christensen
Training and Support Manager


Quentin Christensen
 

Hi William,

You might get more responses for these Python questions in the NVDA developer group: https://groups.io/g/nvda-devel

Kind regards

Quentin.

On Sat, May 14, 2022 at 7:04 PM William <xsuper.sillyx@...> wrote:
Hello,

This question is partly related to NVDA and partly related to Windows
PowerShell.


Supposed I have the following python script and stored in a python file
'test.py', which print out a new string of text after every second.


import time

for i in np.arange(10):

     print('Sleeping', f"{str(round((i-1)/secs*100,
0)).removesuffix('.0')}%", end="\r", flush=True)

     time.sleep(1)

1. I open Windows PowerShell

2. type python test.py

3. the script starts running

I am expecting that NVDA can automatically speak out the new string of
text, but in my test, after the first 'Spleeping...' was spoken, NVDA
did not speak the updated messages.


What can I do to make NVDA speak the updated messages? Thanks.

William











--
Quentin Christensen
Training and Support Manager


William
 

Hello,

This question is partly related to NVDA and partly related to Windows PowerShell.


Supposed I have the following python script and stored in a python file 'test.py', which print out a new string of text after every second.


import time

for i in np.arange(10):

    print('Sleeping', f"{str(round((i-1)/secs*100, 0)).removesuffix('.0')}%", end="\r", flush=True)

    time.sleep(1)

1. I open Windows PowerShell

2. type python test.py

3. the script starts running

I am expecting that NVDA can automatically speak out the new string of text, but in my test, after the first 'Spleeping...' was spoken, NVDA did not speak the updated messages.


What can I do to make NVDA speak the updated messages? Thanks.

William