I have recently reinstalled Pycharm 2018.2.4 professional with a conda install of python 2.7.
Using the same version earlier, I was able to access the local variables after having ran a script in the console. Though, now when I run a script in console only “special variables” are available.
More precisely, if the code runs well, I will be able to retrieve the variable that will be stored at the end. But if the script fails at some point, there is no variable stored. As opposed to before when pycharm was storing values that had been created before the bugged line.
To give you a better understanding, let’s consider the following code :
a=100
b=300
c=b/a
If I do “run in console” the code runs smoothly, then I can do the following
a
>> 100
Now if I change my code to have it do an error :
a=0
b=300
c=b/a
It fails running at the third line. But usually (prior to reinstalling pycharm last week) Any variable created before the error line would still exist. Now, if I run
a
>> error a is not defined
My variables have all been deleted. I don’t understand what’s going on.
Any suggestions is welcome.
Interesting problem, after upgrading to Pycharm 2018.2.4 i can confirm that it is what you describe.
You could use a debug button
Then you can switch to console tab (arrow #1) and you can see the variables (arrow #2)
On console tab you need only to switch on the console prompt button and you are done.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With