a second program - I cannot get the exe to run

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • apple17
    New Member
    • Aug 2006
    • 5

    a second program - I cannot get the exe to run

    I have a game that works fine on my computer. I used pygame2exe to create a .exe and now I get a log file genereated that says:

    File "runloop.py ", line 3, in <module>
    File "zipextimporter .pyo", line 82, in load_module
    File "game1.pyo" , line 5, in <module>
    AttributeError: 'module' object has no attribute 'Bridge'

    here's the code:

    import sys
    import pygame
    import levelobjects
    from player import *
    from Gadgets import *
    from background import *
    from pygame.locals import *

    Does anyone know why?
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    Is Bridge one of your attributes? Sounds like there's a clash.

    Comment

    • apple17
      New Member
      • Aug 2006
      • 5

      #3
      yes it is. what does it mean that there is a 'clash' in the exe and how do I correct this?

      Comment

      • apple17
        New Member
        • Aug 2006
        • 5

        #4
        here's what i have

        in my python setup, i have a folder called Gadgets, in which I have a module called bridge.py.
        In my main program, it says:
        Code:
        import os
        import sys
        import game1
        import pygame
        from pygame.locals import *
        from background import *
        In bridge.py, it says:
        Code:
        import os
        import sys
        import pygame
        from Gadget import *
        from pygame.locals import *
        
        class Bridge(Gadget):
        Last edited by bvdet; Mar 9 '10, 02:06 PM. Reason: Add code tags

        Comment

        • bvdet
          Recognized Expert Specialist
          • Oct 2006
          • 2851

          #5
          Please use code tags when posting code. See posting guidelines here.

          I'm guessing here. Bridge is inheriting from Gadget, but you are not importing module Gadget. You are only importing the contents of module Gadget (unless Gadget is defined in Gadget). Try this:
          Code:
          import Gadget
          BV - Moderator

          Comment

          • apple17
            New Member
            • Aug 2006
            • 5

            #6
            I apologize for posting incorrectly.

            In Gadget, I have

            Code:
            import os
            import sys
            import pygame
            from pygame.locals import *
            
            class Gadget(object):
            Is this not sufficient? (Just a note, this works in a dev environment, but not when I create an exe).

            Thank you for your help.

            Comment

            Working...