1

What I am trying to accomplish is to read file A then run it through a filter process to then write file B with the filtered words. I have other systems in place to have this called when I require it, however, I need to make this an executable file from my guess.

I went ahead and am currently running Python 3.7.9 with pip 20.2.2 I installed pyinstaller to create the executable file. During packing though, it reaches the 1k recursion threshold.

From my knowledge of looking, this means that it is calling on itself in a loop, am I incorrect? I re-wrote it simply and when I run the script it does exactly what I need it to. However, it still comes off as a loop. I may just be missing something simple so thank you to anyone who assists.

Also, because I am newer to this stuff, please keep the terminology to a beginner level if you can. However, if not, I'll be using my best friend google haha.

Thank you guys, here is the code I am working with:

from profanity_filter import ProfanityFilter

pf = ProfanityFilter()

contents = ''
checks = False

def filtering():
    global contents
    myfile = open("D:\\Pictures\\test_project\\Story_Time\\StoryTimeV1.txt")
    contents = pf.censor(myfile.read())
    myfile.close()

def filtering2():    
    global contents
    global checks
    myfile2 = open("D:\\Pictures\\test_project\\Story_Time\\StoryTimeV2.txt", "w")
    myfile2.write(contents)
    myfile2.close()
    checks = True

while checks == False:
    filtering()
    filtering2()

The error code is given:

RecursionError: maximum recursion depth exceeded while calling a Python object

I also am in the correct directory etc. I am sure one of you will be able to pick up on what I may be screwing up haha. Thank you, everyone!

Anurag Dhadse
  • 1,722
  • 1
  • 13
  • 26
Sparoutz
  • 11
  • 1

1 Answers1

0

Does any of the info in pyinstaller creating EXE RuntimeError: maximum recursion depth exceeded while calling a Python object help? It looks like they mainly suggest increasing the recursion limit. If that helps, we should probably mark this as a duplicate.

Danny Rivers
  • 56
  • 1
  • 4
  • it very well could be a duplicate. The problem with not knowing the terminology is not knowing what to look for sometimes. If the recursion limit is increased, would that mean that the .exe file would be made without it failing? Sorry, doing my best to explain. Thank you for your assistance – Sparoutz Aug 23 '20 at 06:09
  • update: I am currently going through the steps, but even at 5000 limit, it still reaches the maximum. I am going to test and see if anything else assists and will update this asap. – Sparoutz Aug 23 '20 at 06:14
  • Excellent, thank you Danny! I was able to get everything running. You can mark this as a duplicate if you need to :) – Sparoutz Aug 23 '20 at 06:21