Ignoring windows registry PythonPath subkeys

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Floris Bruynooghe

    #1

    Ignoring windows registry PythonPath subkeys

    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]


    [2] By looking at getpathp.c it seems just commenting out the two
    calls to getpythonregpat h(), for machinepath and userpath should work
    in most cases.
  • Thomas Heller

    #2
    Re: Ignoring windows registry PythonPath subkeys

    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_DLLVersio nString.
    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

    Comment

    Working...