简体   繁体   English

`import _preamble`在Python中做什么?

[英]What does `import _preamble` do in Python?

I notice the following at the top of Twisted's twistd.py script: 我在Twisted的twistd.py脚本顶部注意到以下内容:

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? import _preamble什么作用? I can't seem to find any references to it on the google-mage. 我似乎在google-mage上找不到任何引用。

_preamble is a module like any other. _preamble是一个与其他模块一样的模块。 In twisted's case, this is simply the module that sets up sys.path so that you can run twisted in development setups. 在twisted的情况下,这只是设置sys.path 的模块 ,以便您可以在开发设置中运行twisted。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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