Breakpoint when first executing my Python script

Hi all,

I am fairly new to scripting and trying to debug this Python script that I wrote inside Rhino 8(cause I am using external packages and wanted to try CPython). My actual problem is that script works fine and does what is intended but everytime when I first open the file(and this only happens on the first time for some reason) I get multiple breakpoints as you can see in the attached image. Does anyone know what might be causing the problem?

Thanks in advance!

Can you share the script? Debugging this from a description will be close to impossible.

I have updated Rhino 8 to the latest version (8.2.23325.14001) to see whether if it was a version issue and unfortunately this time I got much more things popping up. But for some reason code still works!

This is getting real strange :face_with_raised_eyebrow:

So I’ve been trying to debug this code for several days now and I’ve used the newly built-in debugger tool inside script editor to find in which line I get the error. And it seems everytime on the SetSliderValue line it gives me that error. I’ve also looked for other threads such as Giulio Piacentino’s or Sempocoaguilar1’s. But I think maybe with the new CPython inside Rhino 8, I am assuming the SDK also changed cause I’ve also tried to use their methods and files inside CPython but no luck. Then again I’m not hundred percent sure if I am doing the right thing. Any help would be wonderful! @Gijs :slightly_smiling_face:

Can you please also post your Grasshopper definition? It’s difficult to reproduce this without the whole setup.

image
Suggestions?

Oh my bad @brian must have been deleted along some versions. Inside the script first line should be: # r: speechrecognition, pyaudio. I was using external libraries.

image

I’m not sure what we’re trying to do here…

So in this part of the code, using pyaudio, it should detect your microphone and start recording for 5 seconds.

# Function to listen for speech command
def listen_for_command():
    recognizer = sr.Recognizer()
    with sr.Microphone() as source:
        recognizer.adjust_for_ambient_noise(source)
        audio = recognizer.listen(source)

    try:
        command = recognizer.recognize_google(audio)
        print("Recognized speech:", command)
        return command.lower()
    except sr.UnknownValueError:
        print("Could not understand audio. Please try again.")
        return None
    except sr.RequestError:
        print("Unable to access the Google Speech Recognition API.")
        return None

Do you have any microphones or sound input devices attached? Maybe that’s why you are getting this error. So the workflow is you hit run, microphone starts recording for 5 seconds and you should give instructions like “Change building height to 45”(It tries to match the slider nicknames). After that it parses from the speech recognition output and changes the appropriate slider values. Apart from the breakpoints it should work. :melting_face:

I think this computer probably doesn’t have a mic.

I see :disappointed_relieved: thanks anyway @brian . I’ve borrowed my colleague’s laptop with Rhino 8 installed the other day to check whether it was something to do with my laptop but apart from the breakpoints it also worked on his Grasshopper.

I think that’s one of my old scripts. I don’t have Rhino 8, but this looks related (see last post):

Thanks @AndersDeleuran! :pray: Probably you are right.Then I will just have to wait for new bug fixes from @eirannejad regarding RH-78321 and RH-76311.