Python imp.is_frozen() Examples

The following are 30 code examples of imp.is_frozen(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module imp , or try the search function .
Example #1
Source File: util.py    From artisan with GNU General Public License v3.0 6 votes vote down vote up
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 
Example #2
Source File: myutils.py    From darkc0de-old-stuff with GNU General Public License v3.0 6 votes vote down vote up
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() 
Example #3
Source File: vfpfunc.py    From vfp2py with MIT License 6 votes vote down vote up
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) 
Example #4
Source File: ihooks.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #5
Source File: ihooks.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #6
Source File: ihooks.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #7
Source File: ihooks.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #8
Source File: ihooks.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #9
Source File: ihooks.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #10
Source File: ihooks.py    From RevitBatchProcessor with GNU General Public License v3.0 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #11
Source File: ImportManager.py    From moviegrabber with GNU General Public License v3.0 5 votes vote down vote up
def getmod(self, nm,
               isFrozen=imp.is_frozen, loadMod=imp.load_module):
        if isFrozen(nm):
            mod = loadMod(nm, None, nm, ('', '', imp.PY_FROZEN))
            if hasattr(mod, '__path__'):
                mod.__importsub__ = lambda name, pname=nm, owner=self: owner.getmod(pname+'.'+name)
            return mod
        return None 
Example #12
Source File: ihooks.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
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 
Example #13
Source File: ihooks.py    From PokemonGo-DesktopMap with MIT License 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #14
Source File: ihooks.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #15
Source File: ihooks.py    From unity-python with MIT License 5 votes vote down vote up
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 
Example #16
Source File: ihooks.py    From unity-python with MIT License 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #17
Source File: ihooks.py    From unity-python with MIT License 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #18
Source File: pathutils.py    From rstWeb with MIT License 5 votes vote down vote up
def main_is_frozen():
    """Return ``True`` if we're running from a frozen program."""
    import imp
    return (
        # new py2exe
        hasattr(sys, "frozen") or
        # tools/freeze
        imp.is_frozen("__main__")) 
Example #19
Source File: ihooks.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #20
Source File: ihooks.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #21
Source File: ihooks.py    From canape with GNU General Public License v3.0 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #22
Source File: ihooks.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #23
Source File: ihooks.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #24
Source File: ihooks.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #25
Source File: ihooks.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
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 
Example #26
Source File: ihooks.py    From meddle with MIT License 5 votes vote down vote up
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 
Example #27
Source File: ihooks.py    From oss-ftp with MIT License 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #28
Source File: ihooks.py    From meddle with MIT License 5 votes vote down vote up
def is_frozen(self, name): return imp.is_frozen(name) 
Example #29
Source File: ihooks.py    From meddle with MIT License 5 votes vote down vote up
def find_builtin_module(self, name):
        # XXX frozen packages?
        if self.hooks.is_builtin(name):
            return None, '', ('', '', BUILTIN_MODULE)
        if self.hooks.is_frozen(name):
            return None, '', ('', '', FROZEN_MODULE)
        return None 
Example #30
Source File: ihooks.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
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