Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 17100

Why am I getting this error: RecursionError: maximum recursion depth exceeded while pickling an object

$
0
0

I was creating an infinitely looping problem (just for fun), but I encountered this error: "RecursionError: maximum recursion depth exceeded while pickling an object" following this message:

Traceback (most recent call last):  File "<pyshell#34>", line 2, in <module>    exec(p.read())  File "<string>", line 6, in <module>  File "<string>", line 6, in <module>  File "<string>", line 6, in <module>  [Previous line repeated 503 more times]  File "<string>", line 4, in <module>RecursionError: maximum recursion depth exceeded while pickling an object

I did not import the pickling module, and I don't know why this error is occurring.

I ran this code in the Python interpreter:

with open("Cool.py", "a")as p1:    p1.write("""for _ in range(10):\n\t""")    p1.write("""with open("Cool.py" "r")as p1:\n""")    p1.write("""\t\tfor b in p1:\n""")    p1.write("""\t\t\tprint(b)""")

I already have an empty .py file called "Cool.py" in my documents folder (I'm a Mac user).After I run the above code, I run this code to call the file without having to open it:

with open("Cool.py") as p:    exec(p.read())

I know it's lazy, but I'm mainly just curious why it came up with the pickle module.Can anybody explain why I'm getting the error (and how to fix it--although that's less important).


Viewing all articles
Browse latest Browse all 17100

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>