简体   繁体   中英

What does `import _preamble` do in Python?

I notice the following at the top of Twisted's twistd.py script:

import os, sys

try:
    import _preamble
except ImportError:
    sys.exc_clear()

sys.path.insert(0, os.path.abspath(os.getcwd()))

What does import _preamble do? I can't seem to find any references to it on the google-mage.

_preamble is a module like any other. In twisted's case, this is simply the module that sets up sys.path so that you can run twisted in development setups.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM