PYD Files in a subfolder?

For questions about using Classic.

Post » Sun Sep 12, 2010 1:19 am

tulamide, I don't mean to be a bother but is there any way you could show me a working example, both *.cap and compiled? I feel really stupid but for some reason, I just can't get your method to work
B
2
G
2
Posts: 14
Reputation: 678

Post » Sun Sep 12, 2010 2:52 am

[quote="kmvegas":pyxyocab]tulamide, I don't mean to be a bother but is there any way you could show me a working example, both *.cap and compiled? I feel really stupid but for some reason, I just can't get your method to work[/quote:pyxyocab]
Here you are :)

PyPkgTest.rar

The rar contains a folder "PyPkgTest". Wherever I move this folder to both .cap and compiled .exe work. Of course, the inner structure of this parent folder needs to be kept intact. The module is a very *very* easy example module, it's just a class that counts from 10 up with step 10 and resets when reaching 100. But with it you can validate that it's really working.
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sun Sep 12, 2010 6:42 pm

Ah... I think I might know what the issue was. I was attempting to include the py/pyc files within the executable but leave the pyd files outside in the directory / subdirectory. Maybe that's the difference between your method and R0J0's, since his worked for me and yours didn't. In any case, your example does work just fine so I have kind of a template now to experiment with. Thanks much!
B
2
G
2
Posts: 14
Reputation: 678

Post » Mon Sep 13, 2010 4:05 am

You're welcome :)

Could it be some kind of reference problem? Take the "PyPkgTest" folder as an example and copy one of the .pyd (e.g. base.pyd) to the folder "mypython". Now (having appended the game's folder path to sys.path) to reference it, you can't just import "base". It needs to be

[code:nbqn8006]import mypython.base[/code:nbqn8006]or
[code:nbqn8006]from mypython import base[/code:nbqn8006]

For the first one, all calls to "base" must be "mypython.base", the second one let's you reference it directly, without "mypython."

EDIT: Also, Python is case-sensitive. Something like "import myPython.base" won't work, cause the folder is known to Python as "mypython"
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Mon Sep 13, 2010 9:04 pm

Honestly, I think it has something to do with how Pygame references it's files, after looking at some of it's .py files.
B
2
G
2
Posts: 14
Reputation: 678

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest