2

My first Python project, been working on it for 3-4 weeks to mainly learn Python... Been having a blast with Python, until couple of days ago decided to upgrade from python 3.2 to 3.4 and now it wont even run anymore.

It still works with python 3.2, but when I switch it to 3.4 interpreter... Here's the log:

C:\Users\User\Desktop\prj>python main.py
Traceback (most recent call last):
  File "main.py", line 2, in <module>
    import world
RuntimeError: maximum recursion depth exceeded during compilation

Here's the super simplified world.py which is causing this:

import pygame
import events
import collector

events_bringer = events.c_events()
collectimg = collector.ImageController()

class c_world ():

    gridx = 0
    gridy = 0


    def f_function1(self):
        pass

    def f_function2(self):
        pass

    def f_function3(self):
        pass


    def f_gridgetter(self):

        if self.gridx == 0 and self.gridy == 0:
            print("current location %d, %d" % (self.gridx, self.gridy))

I am seriously at dead end. I have no idea what is going on.

If anyone has any idea, I would love to hear it, pretty please.

Day before yesterday I spent 4-5 hours scratching my head, becoming seriously frustrated, kept breather working on other stuff and today came back with no clue formed in my mind.

Also, if you have answer why it runs with 3.2 but not with 3.4... Sincerely appreciated.

Esa T. H.
  • 123
  • 1
  • 4
  • 18
  • Your super simplified code does *not* cause this error. – poke Apr 12 '16 at 20:04
  • Have you looked at http://stackoverflow.com/questions/8177073/python-maximum-recursion-depth-exceeded. Not sure if default stack depth between python 3.2 and 3.4 has changed, but worth a try. – CantrianBear Apr 12 '16 at 20:06
  • Have you tried deleting the contents of the `__pycache__` folder? I'm not an expert in these things but perhaps Python 3.2 and Python 3.4 compile bytecode slightly differently and 3.4 has tripped over some old `.pyc` files compiled by 3.2? – Luke Woodward Apr 12 '16 at 20:08
  • Also, maximum recursive calls in Python is by default 999. Is it possible that you exceed that number? Again, not clue why version 3.4 would warn you and 3.4 not, but still. – CantrianBear Apr 12 '16 at 20:09
  • Btw. the reason this appears in 3.4 is likely because the [compiler was changed during 3.3](http://bugs.python.org/issue5765) to have a recursion limit during compilation. Does your code use `eval` anywhere? Also, what are `events` and `collector`? – poke Apr 12 '16 at 20:09
  • @poke only thing I have simplified is I removed bunch of ifs and elifs, bunch of ints, bunch of booleans. `events` is for events in my game (you probably could guess it is a game by `import pygame`) and `collector` is to save memory when loading images, its basically this: http://www.pygame.org/wiki/LazyImageLoading?parent=CookBook EDIT: and no, I do not think I use `eval` at all. – Esa T. H. Apr 12 '16 at 20:15
  • @LukeWoodward I just did that after you asked, did not fix it. Thanks, though. – Esa T. H. Apr 12 '16 at 20:17
  • @CantrianBear I am 99,99% sure I havent... then again, thats what this error should mean, doesnt it? ... *sigh im so confused*... – Esa T. H. Apr 12 '16 at 21:01
  • Why did you just update to 3.4? 3.5.1 is the latest stable version. – MattDMo Apr 12 '16 at 21:11
  • @MattDMo I am using pygame. If you know where to get pygame for 3.5.1, do link, cuz I have not found it. I've only found pygame for 3.4 downwards. – Esa T. H. Apr 12 '16 at 21:23
  • http://www.lfd.uci.edu/~gohlke/pythonlibs/#pygame – MattDMo Apr 12 '16 at 21:25
  • @MattDMo **Cheers!** though main problem still persists. Might start all over with latest python... :/ pretty demoralized atm though... – Esa T. H. Apr 12 '16 at 21:35
  • No prob. BTW, at the beginning of your class, you should be assigning the variables as `self.gridx = 0; self.gridy = 0` in an `__init__()` function. – MattDMo Apr 12 '16 at 21:37

0 Answers0