Issue Importing Python Libraries

For questions about using Classic.

Post » Sat Apr 28, 2012 9:44 am

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:

[quote] 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[/quote]

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:

[quote]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 95, in <module> from pygame.base import *
ImportError: DLL load failed: The specified module could not be found.[/quote]

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.
B
3
Posts: 2
Reputation: 354

Post » Sat Apr 28, 2012 5:52 pm

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
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sat Apr 28, 2012 10:01 pm

Awesome, glad it was such a simple fix. Thank you so much for the help!
B
3
Posts: 2
Reputation: 354


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests