bug-gnubg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gnubg] Python (win) stuff


From: Massimiliano Maini
Subject: [Bug-gnubg] Python (win) stuff
Date: Thu, 3 Sep 2009 12:38:13 +0200

Hi Christian,

I've been reading around a bit on how to provide the entire Python
library when you embed
python into an appication.

Today, I manually put (some) .py files into PythonLib dir in gnubg's
installation dir.
I verified that if instead of doing this, all the files are zipped
into a python25.zip, it works
(python25.zip is automagically added to the python path).

I did 3 tests:

1. No python installed on the PC (actually I just renamed the
directory, maybe that's not
enough), needed .py files into gnubg's PythonLib dir: this works fine,
it's what I do today
for the distribs.

2. No gnubg's PythonLib directory, needed .pyc files into
python25.zip: this works fine, but
I get an error/warnig at startup of CLI: 'import site' failed; use -v
for traceback'. Everyhting
else works.

3. Python installed on the PC, no python25.zip, no gnubg's PythonLib
dir: this works fine,
but with the same problem as 2 (the import site warning).

I've found this about embedding:

http://stackoverflow.com/questions/551227/deploying-application-with-python-or-another-embedded-scripting-language

It states that we should use:

Py_NoSiteFlag = 1;  // Disable importing site.py
Py_Initialize();    // Create a python interpreter

This would probably solve the above issue.

I was also thinking about the entire PythonLib thing: this directory
seems to be Win
specific (gnubgmodule.c, 2322). If I put the python lib into the zip,
the directory is no
longer needed. Maybe we can just remove this part.

MaX.

P.S.
The entire python lib is roughly 6Mb. I think I can just put it in the
Win distrib, no big
deal if we move from 20Mb to 26mb. OK ?
I would say it's better to provide .pyc files, so that we don't run in
any "write permission'
issue under Vista (even if it would likely work anyway).




reply via email to

[Prev in Thread] Current Thread [Next in Thread]