I just updated Spyder, and now I have the following issue.
If I enter in the console:
>>> a = 1
>>> print(a)
1
Then if I run the following single-line script:
print(a)

I get the error:
NameError: name 'a' is not defined

Even though 'a' is clearly defined in the Variable Explorer.

According to chatGPT, Python has always worked this way, with a script 
apparently having it's own 'scope', without access to global variables.
I've used Python for years and never heard anything remotely like this. I 
access global variables from scripts all the time and never had an issue, 
in both ABAQUS and Spyder. Then suddenly I update Spyder and have this 
issue. Can someone please explain why it worked for me before and not now? 
And how I can fix this?

chatGPT says add the line 'global a', which is not acceptable solution for 
me even if it worked, but even that doesn't solve the error.

Thanks,
Ryan

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to spyderlib+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/spyderlib/4a403439-4d4f-4d08-8c3c-5ae247c749ffn%40googlegroups.com.

Reply via email to