[WinError 6] The handle is invalid on IIS

Laman Bayramova 0 Reputation points
2024-09-27T07:04:57.7666667+00:00

Hello,I get this error :

[WinError 6] The handle is invalid

This code work with vscode. But When I publish with IIS i get error. path is true,permission IISUSERS is already exists. Why i get error.pls help me


    path='./Audio/pscloud3456Imagetestogg_733bcef2b5504dd5b16b3ae776f4fbd5.wav'
    with sr.AudioFile(path) as source:
      audio_data = sr.Recognizer().record(source) 
    r = sr.Recognizer()
    text = r.recognize_google(audio_data, language='en-US') 
    return text     
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,725 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vasileios Dionysopoulos 641 Reputation points
    2024-09-27T13:06:12.5633333+00:00

    Hello Laman,

    Have you check if the path of audio is ok? you can test it with the full path or absolute path:

    path = 'C:/path_to_project/Audio/......'

    Maybe another issue is the file permission of the audio file, to make some check apply everyone...

    Also you have to pip the correct libraries (I assume that you have already done that).

    Last but not least close all the programs that use the file due to file lock issue.

    If you need something further pm me.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.