Movatterモバイル変換
[0]ホーム
[Python-Dev] DLL in the system directory on Windows.
Guido van Rossumguido@python.org
Tue, 04 Apr 2000 16:45:12 -0400
> Me. Would you have any sympathy for someone who wanted> to make a GUI an integral part of a web server? Or would you> tell them to get a brain and write a GUI that talks to the web> server? Same issue. (Though not, I guess, for pyexpat).Not all COM objects are used in web servers. Some are used in GUIcontexts (aren't Word and Excel and even IE really mostly COM objectsthese days?).> > It's annoying.> >> > I have noticed, however, that you can use os.putenv() (or assignment> > to os.environ[...]) to change the PATH environment variable. The> > FixTk.py script in Python 1.5.2 used this -- it looked in a few places> > for signs of a Tcl/Tk installation, and then adjusted PATH to include> > the proper directory before trying to import _tkinter. Maybe there's> > a solution here? The Python DLL could be the only thing in the system> > directory, and from the registry it could know where the Python> > directory was. It could then prepend this directory to PATH. This is> > not so evil as mucking with PATH at install time, I think, since it is> > only done when Python16.dll is actually loaded.>> The drawback of relying on PATH is that then some other jerk> (eg you, last year <wink>) will stick something of the same> name in the system directory and break your installation.Yes, that's a problem, especially since it appears that PATH issearched *last*.(I wonder if this could explain the hard-to-reproduce crashes thatpeople report when quitting IDLE?)> > Would this always work? (Windows 95, 98, NT, 2000?) Wouldn't it run> > out of environment space? Wouldn't it break other COM apps? Is the> > PATH truly separate per process?>> Are there any exceptions to this:> - dynamically load a .pyd> - .pyd implicitly loads the .dll> ?I think this is always the pattern (except that some DLLs willimplicitly load other DLLs, and so on).> If that's always the case, then you can temporarily cd to the> right directory before the dynamic load, and the implicit load> should work.Hm, I would think that the danger of temporarily changing the currentdirectory is at least as big as that of changing PATH. (What aboutother threads? What if you run into an error and don't get a chanceto cd back?)> As for the others: probably not; can't see how; yes.--Guido van Rossum (home page:http://www.python.org/~guido/)
[8]ページ先頭