By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,100 Members | 2,846 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,100 IT Pros & Developers. It's quick & easy.

Ignoring windows registry PythonPath subkeys

P: n/a
Hi

We basically want the same as the OP in [1], i.e. when python starts
up we don't want to load *any* sys.path entries from the registry,
including subkeys of the PythonPath key. The result of that thread
seems to be to edit PC/getpathp.c[2] and recompile.

This isn't that much of a problem since we're compiling python anyway,
but is that really still the only way? Surely this isn't such an
outlandish requirement?
Regards
Floris
[1]
http://groups.google.com/group/comp....47f905eb3f990a

[2] By looking at getpathp.c it seems just commenting out the two
calls to getpythonregpath(), for machinepath and userpath should work
in most cases.
Apr 4 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Floris Bruynooghe schrieb:
Hi

We basically want the same as the OP in [1], i.e. when python starts
up we don't want to load *any* sys.path entries from the registry,
including subkeys of the PythonPath key. The result of that thread
seems to be to edit PC/getpathp.c[2] and recompile.

This isn't that much of a problem since we're compiling python anyway,
but is that really still the only way? Surely this isn't such an
outlandish requirement?
If you look into PC/getpathp.c *and* PC/dl_nt.c, you'll find that the registry key name
if constructed from static components plus a variable component named PyWin_DLLVersionString.
The latter is loaded from a string resource (with resource ID 1000, IIRC) inside the pythonXY.dll.

This string resource can be changed (even without compiling!); so this is a way
for you to force the lookup of PythonPath to a different registry key. You can choose
something that probably does not exist.

py2exe does this also for 'frozen' executables, and so has complete control
over sys.path.

Thomas

Apr 4 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.