New submission from Kristján Valur Jónsson <krist...@ccpgames.com>:

When calling Py_Initialize() from an embedding application, there is currently 
no way for the application to override Python's initial settin g of sys.path.  
An elaborate mechanism in getpathp.c kicks in, guessing the path based on 
several criteria.

Ideally, this mechanism, which is valid only for python.exe and its semantics, 
should be opt in.  It forces embedders that have their own libraries to go 
through complicated hoops (with environment variables and what not) to direct 
their embedded interpreter at the right place for modules, and to make sure 
that it is not confused by any other python distribution present on the system.

This submission adds a Py_SetPath() function to the API.  This has been 
successfully used by CCP in EVE Online and other products to completely 
override python's path guessing mechanics.  If called with a semicolon 
separated path prior to Py_Initialize, it will be used as the fodder for the 
initial sys.path.

----------
components: Interpreter Core
files: py_setpath.patch
keywords: easy, needs review, patch
messages: 117030
nosy: krisvale
priority: normal
severity: normal
status: open
title: Add Py_SetPath API for embeddint python
type: feature request
versions: Python 3.2
Added file: http://bugs.python.org/file18943/py_setpath.patch

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9910>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to