当前位置: 首页>>代码示例>>Python>>正文


Python sys._MEIPASS属性代码示例

本文整理汇总了Python中sys._MEIPASS属性的典型用法代码示例。如果您正苦于以下问题:Python sys._MEIPASS属性的具体用法?Python sys._MEIPASS怎么用?Python sys._MEIPASS使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在sys的用法示例。


在下文中一共展示了sys._MEIPASS属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: restart

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def restart(self):
        if getattr(sys, '_MEIPASS', False):
            if platform.system() == 'Windows':
                subprocess.Popen([wl_misc.get_normalized_path('Wordless.exe')])
            elif platform.system() == 'Darwin':
                subprocess.Popen([wl_misc.get_normalized_path('Wordless')])
            elif platform.system() == 'Linux':
                subprocess.Popen([wl_misc.get_normalized_path('Wordless')])
        else:
            if platform.system() == 'Windows':
                subprocess.Popen(['python', wl_misc.get_normalized_path(__file__)])
            elif platform.system() == 'Darwin':
                subprocess.Popen(['python3', wl_misc.get_normalized_path(__file__)])
            elif platform.system() == 'Linux':
                subprocess.Popen(['python3.7', wl_misc.get_normalized_path(__file__)])

        self.save_settings()
        sys.exit(0) 
开发者ID:BLKSerene,项目名称:Wordless,代码行数:20,代码来源:wl_main.py

示例2: meta_validate

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def meta_validate(shacl_graph, inference='rdfs', **kwargs):
    shacl_shacl_graph = meta_validate.shacl_shacl_graph
    if shacl_shacl_graph is None:
        from os import path
        import pickle
        import sys
        if getattr( sys, 'frozen', False ) :
                # runs in a pyinstaller bundle
                here_dir = sys._MEIPASS
                pickle_file = path.join(here_dir, "shacl-shacl.pickle")
        else :
                here_dir = path.dirname(__file__)
                pickle_file = path.join(here_dir, "shacl-shacl.pickle")
        with open(pickle_file, 'rb') as shacl_pickle:
            u = pickle.Unpickler(shacl_pickle, fix_imports=False)
            shacl_shacl_store = u.load()
        shacl_shacl_graph = rdflib.Graph(store=shacl_shacl_store, identifier="http://www.w3.org/ns/shacl-shacl")
        meta_validate.shacl_shacl_graph = shacl_shacl_graph
    shacl_graph = load_from_source(shacl_graph, rdf_format=kwargs.pop('shacl_graph_format', None),
                                   multigraph=True)
    _ = kwargs.pop('meta_shacl', None)
    return validate(shacl_graph, shacl_graph=shacl_shacl_graph, inference=inference, **kwargs) 
开发者ID:RDFLib,项目名称:pySHACL,代码行数:24,代码来源:validate.py

示例3: create_app

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def create_app(config="cryptoadvance.specter.config.DevelopmentConfig"):
    # Enables injection of a different config via Env-Variable
    if os.environ.get("SPECTER_CONFIG"):
        config = os.environ.get("SPECTER_CONFIG")

    if getattr(sys, 'frozen', False):

        # Best understood with the snippet below this section:
        # https://pyinstaller.readthedocs.io/en/v3.3.1/runtime-information.html#using-sys-executable-and-sys-argv-0
        template_folder = os.path.join(sys._MEIPASS, 'templates')
        static_folder = os.path.join(sys._MEIPASS, 'static')
        logger.info("pyinstaller based instance running in {}".format(sys._MEIPASS))
        app = Flask(__name__, template_folder=template_folder, static_folder=static_folder)
    else:
        app = Flask(__name__, template_folder="templates", static_folder="static")
    app.config.from_object(config)
    return app 
开发者ID:cryptoadvance,项目名称:specter-desktop,代码行数:19,代码来源:server.py

示例4: __init__

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def __init__(self, loginQueue):
        tk.Toplevel.__init__(self)
        
        self.configure(pady=10, padx=20)
        
        self.wm_attributes("-topmost", True)
        self.wm_title("PyEveLiveDPS Awaiting Login")
        try:
            self.iconbitmap(sys._MEIPASS + '\\app.ico')
        except Exception:
            try:
                self.iconbitmap("app.ico")
            except Exception:
                pass
        self.geometry("200x50")
        self.update_idletasks()
            
        tk.Label(self, text='Waiting for you to login...').grid(row=1, column=1)

        self.loginStatus = loginQueue.get()

        self.destroy() 
开发者ID:ArtificialQualia,项目名称:PyEveLiveDPS,代码行数:24,代码来源:fleetConnectionWindow.py

示例5: __init__

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def __init__(self, *args, **kw):
      if hasattr(sys, 'frozen'):
        # We have to set original _MEIPASS2 value from sys._MEIPASS
        # to get --onefile mode working.
        os.putenv('_MEIPASS2', sys._MEIPASS)
      try:
        super(_Popen, self).__init__(*args, **kw)
      finally:
        if hasattr(sys, 'frozen'):
          # On some platforms (e.g. AIX) 'os.unsetenv()' is not
          # available. In those cases we cannot delete the variable
          # but only set it to the empty string. The bootloader
          # can handle this case.
          if hasattr(os, 'unsetenv'):
            os.unsetenv('_MEIPASS2')
          else:
            os.putenv('_MEIPASS2', '')

  # Second override 'Popen' class with our modified version. 
开发者ID:lanjelot,项目名称:patator,代码行数:21,代码来源:patator.py

示例6: __init__

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def __init__(self, *args, **kw):
            if hasattr(sys, 'frozen'):
                # We have to set original _MEIPASS2 value from sys._MEIPASS
                # to get --onefile mode working.
                os.putenv('_MEIPASS2', sys._MEIPASS)
            try:
                super(_Popen, self).__init__(*args, **kw)
            finally:
                if hasattr(sys, 'frozen'):
                    # On some platforms (e.g. AIX) 'os.unsetenv()' is not
                    # available. In those cases we cannot delete the variable
                    # but only set it to the empty string. The bootloader
                    # can handle this case.
                    if hasattr(os, 'unsetenv'):
                        os.unsetenv('_MEIPASS2')
                    else:
                        os.putenv('_MEIPASS2', '')

    # Second override 'Popen' class with our modified version. 
开发者ID:devgc,项目名称:EventMonkey,代码行数:21,代码来源:EventMonkey.py

示例7: GetResource

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def GetResource(frozen_loc,resource_loc,resource_name):
    ''' Get resource by location and name. This will compensate for frozen or not.
    
    args:
        frozen_loc: location of resource when frozen
        resource_loc: location of resource in package (not frozen)
        resource_name: name of the file
    returns:
        location: The abs location
    '''
    location = None
    
    if getattr(sys,'frozen',False):
        location = os.path.join(sys._MEIPASS,frozen_loc)
        location = os.path.join(location,resource_name)
        location = os.path.abspath(location)
    else:
        location = os.path.abspath(
            pkg_resources.resource_filename(
               resource_loc,
                resource_name
            )
        )
        
    return location 
开发者ID:devgc,项目名称:EventMonkey,代码行数:27,代码来源:Utilities.py

示例8: getDataDir

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def getDataDir(path=""):
    '''
    Returns the folder where the executable is located. (This function is ran on non-Windows OS's)
    
    :param path: Additional directories/files to join to the data directory path
    
    :return unicode
    '''
    # if sys.platform == "win32":
    #     def fsdecode(x):
    #         return x.decode(sys.getfilesystemencoding())
    #
    #     dataDir = os.getcwdu()
    #     '''
    #     if getattr(sys, 'frozen', False):
    #         dataDir = os.path.dirname(sys._MEIPASS)
    #     else:
    #         dataDir = os.path.dirname(__file__)
    #     '''
    #
    # else:
    dataDir = os.getcwdu()
    if len(path) > 0:
        return os.path.join(dataDir, path)
    return dataDir 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:27,代码来源:directories.py

示例9: absPath

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def absPath(myPath):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    import sys

    try:
        # PyInstaller creates a temp folder and stores path in _MEIPASS
        base_path = sys._MEIPASS
        logger.debug("found MEIPASS: %s "%os.path.join(base_path, os.path.basename(myPath)))

        return os.path.join(base_path, os.path.basename(myPath))
    except Exception as e:
        logger.debug("did not find MEIPASS: %s "%e)


        base_path = os.path.abspath(os.path.dirname(__file__))
        return os.path.join(base_path, myPath) 
开发者ID:maweigert,项目名称:spimagine,代码行数:18,代码来源:spimagine_gui.py

示例10: absPath

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def absPath(myPath):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    import sys

    try:
        # PyInstaller creates a temp folder and stores path in _MEIPASS
        base_path = sys._MEIPASS
        logger.debug("found MEIPASS: %s " % os.path.join(base_path, os.path.basename(myPath)))

        return os.path.join(base_path, os.path.basename(myPath))
    except Exception:
        base_path = os.path.abspath(os.path.dirname(__file__))
        return os.path.join(base_path, myPath)


############################################################################ 
开发者ID:maweigert,项目名称:spimagine,代码行数:18,代码来源:data_model.py

示例11: loadcolormaps

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def loadcolormaps():
    cmaps = {}

    try:
        basePath = sys._MEIPASS
    except:
        basePath = _absPath("../colormaps/")

    reg = re.compile("cmap_(.*)\.png")
    for fName in os.listdir(basePath):
        match = reg.match(fName)
        if match:
            try:
                cmaps[match.group(1)] = _arrayFromImage(os.path.join(basePath,fName))[0,:,:]
            except Exception as e:
                print(e)
                print("could not load %s"%fName)

    return cmaps 
开发者ID:maweigert,项目名称:spimagine,代码行数:21,代码来源:loadcolormaps.py

示例12: absPath

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def absPath(myPath):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    import sys

    try:
        # PyInstaller creates a temp folder and stores path in _MEIPASS
        base_path = sys._MEIPASS
        logger.debug("found MEIPASS: %s "%os.path.join(base_path, os.path.basename(myPath)))

        return os.path.join(base_path, os.path.basename(myPath))
    except Exception:

        base_path = os.path.abspath(os.path.dirname(__file__))
        logger.debug("didnt found MEIPASS...: %s "%os.path.join(base_path, myPath))

        return os.path.join(base_path, myPath) 
开发者ID:maweigert,项目名称:spimagine,代码行数:18,代码来源:keyframe_view.py

示例13: get_resource

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def get_resource(resource):
    if not hasattr(sys, 'frozen'):
        return pkg_resources.resource_filename('rfmonitor.ui', resource)
    else:
        return os.path.join(sys._MEIPASS, 'ui', resource) 
开发者ID:EarToEarOak,项目名称:RF-Monitor,代码行数:7,代码来源:utils_ui.py

示例14: path

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def path(f):
    if hasattr(sys, "_MEIPASS"):  # when freezed with pyinstaller ;-)
        return os.path.join(sys._MEIPASS, f)
    else:
        return os.path.join(PATH, f) 
开发者ID:manatlan,项目名称:wuy,代码行数:7,代码来源:wuy.py

示例15: test_path

# 需要导入模块: import sys [as 别名]
# 或者: from sys import _MEIPASS [as 别名]
def test_path():
    assert not hasattr(sys, "_MEIPASS")
    assert wuy.path("jo") == os.path.join(os.getcwd(), "jo") 
开发者ID:manatlan,项目名称:wuy,代码行数:5,代码来源:test_utilities.py


注:本文中的sys._MEIPASS属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。