Problem with urllib2 in Python - ChatGPT script

Hello! I have a problem when I try to run a python script, so that I can link it with Chat GPT. The error apparently comes from the urllib2 module. So, when I open the VisualStudioCode, it details what the errors are. But since I don’t know anything about scripting, I don’t know how to solve it. And this script running well in others machines.

Thanks in advance!

I would not look at the urllib2 code. What you are seeing is probably based on Python 3 selection in visual studio code. Python in Rhino is based on 2.7.

Anyway, instead look at the Python code in your scripting component, most specifically line 16, but preferrably the entire script. I’d use my electro-telepathic capabilities, but unfortunately those are non-existent, so I am unable to read your script from your machine. Probably best to share the code of the scripting component so others can see what you did there and spot the actual error.

Hi Nathan, thanks for answer! Sure, here is the script:

I hope the issue where there.

I’d put lines 14-23 in a try-except block and print out what the error is you’re getting, see 8. Errors and Exceptions — Python 2.7.18 documentation . My guess is probably your api key is incorrect.

You probably make it easier for yourself if you tried this script first with _EditPythonScript because you can put breakpoints and investigate more. Once it works you can put it back into your scripting component.

Thank’s a lot Nathan, i will check that!