Терминальный процесс «C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe» завершился с кодом выхода: -1Python

Программы на Python
Ответить
Anonymous
 Терминальный процесс «C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe» завершился с кодом выхода: -1

Сообщение Anonymous »

Я сталкиваюсь с вышеуказанной ошибкой при попытке запустить любой код Python на VSC; возможно, это связано с тем, что на моем компьютере установлена ​​программа «KidSafe» («KidSafe» — буквальное имя). Если это действительно так, может кто-нибудь научить меня, как его удалить? Что может «KidSafe»: заблокировать диспетчер задач, cmd и позволить «родительскому» пользователю управлять веб-фильтрацией и фильтрацией игр. Так что да, мои родители не могут открыть какие-либо автоматически «запрещенные» функции: опять же, диспетчер задач, cmd и, возможно, что-то еще... (это я пытаюсь указать, что «родительские» пользователи не могут помочь в открытии cmd, диспетчера задач, которые, я думаю, являются одними из основных способов исправить это?)
Я попробовал устранить неполадки с помощью этого веб-сайта: https://code.visualstudio.com/docs/supp ... nal-launch
И это привело меня сюда, чтобы попросить о помощи.
Пример типа кода, который я хочу запустить:
import speech_recognition as sr
from datetime import datetime
import pyttsx3
import wikipedia

engine = pyttsx3.init()
engine.setProperty('rate', 170)
engine.setProperty('volume', 1.0)
def speak(text):
if text:
engine.say(text)
engine.runAndWait()
def format_text(text):
if not text:
return ""
text = text[0].upper() + text[1:]
if text[-1] not in ['.', '!', '?']:
text += '.'
return text

def process_command(text):
text_lower = text.lower()

if "time" in text_lower:
current_time = datetime.now().strftime("%H:%M")
response = f"The current time is {current_time}."
print(response)
return response

elif "date" in text_lower:
current_date = datetime.now().strftime("%d %B %Y")
response = f"Today's date is {current_date}."
print(response)
return response

elif "your name" in text_lower or "who are you" in text_lower:
response = "I am... Wait, wh... Ask me another question!"
print(response)
return response

elif "how are you" in text_lower:
response = "I am fine..."
print(response)
return response

elif "say something" in text_lower:
response = "Ok, type in your message."
print(response)
tts = input(" ")
speak(tts)
return response

elif any(phrase in text_lower for phrase in ["who is", "what is", "tell me about", "definition of"]):
query = text_lower.replace("who is", "").replace("what is", "").replace("tell me about", "").replace("definition of", "")
try:
result = wikipedia.summary(query, sentences=2)
speak(result)
return result
except wikipedia.exceptions.DisambiguationError:
response = "There are too many results for that name. Please be more specific."
speak(response)
return response
except wikipedia.exceptions.PageError:
response = "I could not find any results for that on Wikipedia."
speak(response)
return response
except Exception as e:
print(e)
speak("Something went wrong with the search.")
return "Error."

else:
return format_text(text)

def listen_and_process():
recognizer = sr.Recognizer()

with sr.Microphone() as source:
print("Listening... (Speak English clearly)")
recognizer.adjust_for_ambient_noise(source, duration=0.8)

try:
audio = recognizer.listen(source, timeout=10)

raw_text = recognizer.recognize_google(audio)

final_output = process_command(raw_text)

command_keywords = ["time", "date", "how are you", "name", "who is", "what is", "tell me about"]

is_command = any(keyword in raw_text.lower() for keyword in command_keywords)

if not is_command:
print(f"You said: {final_output}")

except sr.UnknownValueError:
print("Sorry, I could not understand the audio.")
except sr.RequestError as e:
print("Could not request results; check your Internet connection:", e)

if __name__ == "__main__":
listen_and_process()


Подробнее здесь: https://stackoverflow.com/questions/798 ... rshell-exe
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»