Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
'utils.in_a_shell()' : stack overflow. #119
Happens on Pycharm 2016.2.2, works fine on console.
from redbaron import RedBaron import textwrap code = textwrap.dedent("""\ def a(): pass""") red = RedBaron(code) red.value.insert(0, 'a') # <- problem here
I have currently set 'utils.in_a_shell()' default return to True instead of False. This fixes the problem but i am not sure if this is a correct way to do it.
Thanks for the good work :)
You should avoid running large programs in PyCharm using
I did not suggest you to use terminal instead of PyCharm. The advice was in running program, not in implementing.
I have tried with Python 2.7.12 and what I got if I run in PyCharm (last two lines):
Is is exactly what I mentioned on my previous comment.
And what I get if I run via terminal:
def a(): a pass
So, it is the same thing as with Python 3.5 except error output.
Actually, it is not a bug. If you try to add this line on your code:
redbaron.DEBUG = True
Everything will work fine.
Clearly if i am using some development environment i want to also run code in that environment, think about debugging for example. Furthermore i have all my unit-tests failing because i am using pycharm's test integration.
Setting the DEBUG flag fixes the problem, but i believe some permanent fix is required as this issue will very likely rise for other people as well.
There are another solutions:
referenced this issue
Oct 3, 2016
@petspats so just running the program you showed produces that much recursion? I didn't check the code for this issues but that seems indeed like way too much recursion for such a "simple" parsing.