Hi everyone, I am running a simple Python script using the OpenAI API to correct a spelling mistake in a sentence in PyCharm using Python v3.10, the problem is it shows that the “Process finished with exit code 0” but nothing shows up! It works perfectly fine in the OpenAI Playground, but doesn’t work in my instance. I definitely have the correct API Code in the .env file. I have attached the screenshot showing what’s happening.
Thanks very much for your help!
Is that all of your code? Or is there more?
Thanks for your help! This all the code there is. Is there something missing? It’s taken directly from the OpenAI Playground. This same problem (no results showing and with the message “Process finished with exit code 0”, I’ve looked into that message and it’s just a confirmation that it worked) happens with the other scripts.
I have tried everything to get this to work!
Ok! Good news! when you call
openai.Edit.create it only gives the result, so you need to store it,
text = openai.Edit.create
Then you need to print it, but it gives it BIG output, so you want to section it down. So the finished code should look like this:
openai.api_key = os.getenv("OPENAI_API_KEY")
text = openai.Edit.create(
input="What day of the wek is it?",
instruction="Fix the spelling mistakes"
openai_result = text.choices.text
let me know if you have any other questions!
Thanks so much! You’re awesome!