Issue Importing Python Libraries

This forum is currently in read-only mode.
  • Hello!

    Getting straight to what I think may be my issue, I'm curious if scripting in Construct Classic supports imported python libraries that are built using Python 2.7. (I am aware that Classic natively uses 2.6)

    As far as the details of my problem go, I'm trying to import the pygame library into Construct Classic for scripting use. I have followed the Python library tutorials that are linked on the wiki and elsewhere to the best of my ability. When I first ran my game, it threw up this error:

    Traceback (most recent call last):

    File "<string>", line 1, in <module>

    File "C:\Program Files (x86)\Scirra\Construct Classic\Data\Python\pygame\__init__.py". line 27, in <module> import, os, string

    File "C:\Python26\lib\string.py", line 83, in <module>

    ImportError: Bad magic number in C:\Program Files (x86)\Scirra\Construct Classic\Data\Python\re.pyc

    From what I've gathered by googling around, "bad magic number" errors sound like they relate to trying to run code from later Python versions using an earlier version's interpreter. Now when I've run the game ever since, it gives this error:

    raceback (most recent call last):

    File "<string>", line 1, in <module>

    File "C:\Program Files (x86)\Scirra\Construct Classic\Data\Python\pygame\__init__.py". line 95, in <module> from pygame.base import *

    ImportError: DLL load failed: The specified module could not be found.

    I'd appreciate it if someone could at least give me an idea of if I'm on the right track as far as diagnosing my own problem goes. I am pretty inexperienced in Construct and a complete newborn in programming languages (which is why I'm trying to teach myself both!), so I'm really kind of in the dark.

    I can post a .cap file if desired, but seeing as how it's a problem on my system I doubt it would help.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Your diagnosis is correct it's not working since you are using the version of pygame built for python 2.7 and construct uses 2.6.

    Download the version of pygame built for python 2.6 and that should solve it.

    http://www.pygame.org/download.shtml

  • Awesome, glad it was such a simple fix. Thank you so much for the help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)