[Twisted-Python] Importing reactor changes PATHs?

Michael Schlenker msc at contact.de
Mon May 26 08:26:10 MDT 2014


Am 26.05.2014 16:12, schrieb Merovingian:
> Hello,
> 
> Python 2.7.5 32 bit on Windows.
> Twisted 13.2.0
> 
>     import ctypes
>     dll = ctypes.CDLL("ssleay32.dll")
> 
> Loads dll from the current folder
> 
>     import ctypes
>     from twisted.internet import reactor
>     dll = ctypes.CDLL("ssleay32.dll")
> 
> Loads dll from Python27\lib\site-packages\OpenSSL
> How so? How can I prevent reactor from changing the PATH (or whatever
> it's changing)?

It might not be PATH.

There are a ton of options, e.g. the Manifest in use, Application
configuration files, registry settings or code used in Python to change
the ActivationContext when loading things.

In addition, you might already have loaded the 'ssleay32.dll' in the
reactor call, so the second call doesn't really load it anymore.

In fact, 'twisted.internet import reactor' does just that, it loads its
own copy of 'ssleay32.dll', and as your ctypes call does not specifiy an
absolute path or sets up any activation context, you get the already
loaded DLL.

Michael

-- 
Michael Schlenker
Software Architect

CONTACT Software GmbH           Tel.:   +49 (421) 20153-80
Wiener Straße 1-3               Fax:    +49 (421) 20153-41
28359 Bremen
http://www.contact.de/          E-Mail: msc at contact.de

Sitz der Gesellschaft: Bremen
Geschäftsführer: Karl Heinz Zachries, Ralf Holtgrefe
Eingetragen im Handelsregister des Amtsgerichts Bremen unter HRB 13215



More information about the Twisted-Python mailing list