本文整理匯總了Python中imp.is_frozen方法的典型用法代碼示例。如果您正苦於以下問題:Python imp.is_frozen方法的具體用法?Python imp.is_frozen怎麽用?Python imp.is_frozen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類imp
的用法示例。
在下文中一共展示了imp.is_frozen方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: vfp_sys
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def vfp_sys(funcnum, *args):
global SYS2000iter
if funcnum == 16:
import imp
if hasattr(sys, "frozen") or hasattr(sys, "importers") or imp.is_frozen("__main__"):
return os.path.dirname(sys.executable)
return os.path.dirname(sys.argv[0])
if funcnum == 2000:
#seems to implement FindFirstFile and FindNextFile in win32api
if len(args) == 1:
skel, = args
next_file = False
else:
skel, next_file = args[:2]
if next_file:
try:
return next(SYS2000iter)
except:
return ''
SYS2000iter = glob.iglob(skel)
return vfp_sys(2000, skel, 1)
示例2: main_is_frozen
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def main_is_frozen():
return (hasattr(sys, "frozen") or # new py2exe
hasattr(sys, "importers") or # old py2exe
imp.is_frozen("__main__")) # tools/freeze
#~ if __name__ == '__main__':
#some test code here.
#~ def hello(name="bla"):
#~ print "hello, ", name
#~ myt = MyTimer(1.0, 5, hello, ["bob"])
#~ myt.start()
#~ time.sleep(4)
#~ myt.cancel()
#~ print "next timer"
#~ myt = MyTimer(1.0, 0, hello, ["bob"])
#~ myt.start()
#~ time.sleep(6)
#~ myt.cancel()
示例3: appFrozen
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def appFrozen():
ib = False
try:
platf = str(platform.system())
if platf == "Darwin":
# the sys.frozen is set by py2app and pyinstaller and is unset otherwise
if getattr( sys, 'frozen', False ):
ib = True
elif platf == "Windows":
ib = (hasattr(sys, "frozen") or # new py2exe
hasattr(sys, "importers") # old py2exe
or imp.is_frozen("__main__")) # tools/freeze
elif platf == "Linux":
if getattr(sys, 'frozen', False):
# The application is frozen
ib = True
except Exception:
pass
return ib
示例4: find_builtin_module
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def find_builtin_module(self, name):
# XXX frozen packages?
if imp.is_builtin(name):
return None, '', ('', '', BUILTIN_MODULE)
if imp.is_frozen(name):
return None, '', ('', '', FROZEN_MODULE)
return None
示例5: is_frozen
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def is_frozen(self, name): return imp.is_frozen(name)
示例6: test_is_frozen
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def test_is_frozen(self):
for name in self.temp_name:
f = imp.is_frozen(name)
self.assertFalse(f)
示例7: main_is_frozen
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def main_is_frozen():
return(hasattr(sys, "frozen") or \
hasattr(sys, "importers") or \
imp.is_frozen("__main__"))
示例8: main_is_frozen
# 需要導入模塊: import imp [as 別名]
# 或者: from imp import is_frozen [as 別名]
def main_is_frozen():
return (hasattr(sys, "frozen") or # new py2exe
hasattr(sys, "importers") # old py2exe
or imp.is_frozen("__main__")) # tools/freeze