embedding Pyd in Windows program

Matt via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 11 19:59:10 PDT 2015


On Wednesday, 11 March 2015 at 21:45:20 UTC, Matt wrote:
> On Wednesday, 11 March 2015 at 19:32:05 UTC, Matt wrote:
>> I'm trying to build a simple platformer using SDL2 and python 
>> to script entities, but I'm struggling to include Pyd. I'm 
>> using DMD v2.066.1, with dub as the package manager, and 
>> derelict for the SDL2 bindings.
>>
>> Now, when I add Pyd to my dub.json everything works fine, but 
>> as soon as I add py_init(), my code compiles and links fine, 
>> but I get "ImportError: No module named site". Have I done 
>> something wrong? Can anyone shed some light on this? Or am I 
>> asking in the wrong place?
>>
>> Any help would be very much appreciated, and I can provide 
>> code on request if that helps.
>
> Well, apparently I didn't check the Python side of things. 
> "site" is a python module that is loaded by the interpreter, 
> meaning my python environment variables apparently haven't been 
> set properly, despite the fact that my standalone interpreter 
> can find them with no problem. I'm going to keep plugging away 
> at this, see if there's any way to sort this out.

Right, copying site.py into my program's working dir sorts out 
the missing module error, but I now get a syntax error:

     file=sys.stderr)
         ^
SyntaxError: invalid syntax
Error executing command run: Program exited with code 1

I googled this, and apparently it's caused by an older 
interpreter. The only files I have transferred over are:
   python3.DLL
   python3.LIB
   python34.LIB

Does anyone have any idea what I might be doing wrong, or how I 
can fix this?


More information about the Digitalmars-d-learn mailing list