Python sys._MEIPASS Examples
The following are 30
code examples of sys._MEIPASS().
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
sys
, or try the search function
.
Example #1
Source File: fleetConnectionWindow.py From PyEveLiveDPS with GNU General Public License v3.0 | 7 votes |
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()
Example #2
Source File: Utilities.py From EventMonkey with Apache License 2.0 | 6 votes |
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
Example #3
Source File: wl_main.py From Wordless with GNU General Public License v3.0 | 6 votes |
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)
Example #4
Source File: spimagine_gui.py From spimagine with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #5
Source File: data_model.py From spimagine with BSD 3-Clause "New" or "Revised" License | 6 votes |
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) ############################################################################
Example #6
Source File: server.py From specter-desktop with MIT License | 6 votes |
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
Example #7
Source File: loadcolormaps.py From spimagine with BSD 3-Clause "New" or "Revised" License | 6 votes |
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
Example #8
Source File: directories.py From GDMC with ISC License | 6 votes |
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
Example #9
Source File: validate.py From pySHACL with Apache License 2.0 | 6 votes |
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)
Example #10
Source File: EventMonkey.py From EventMonkey with Apache License 2.0 | 6 votes |
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.
Example #11
Source File: patator.py From patator with GNU General Public License v2.0 | 6 votes |
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.
Example #12
Source File: keyframe_view.py From spimagine with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #13
Source File: onefile.py From Resource-Pack-Converter with MIT License | 5 votes |
def resource_path(relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
Example #14
Source File: volrender_tester.py From spimagine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def absPath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #15
Source File: volsettings.py From spimagine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def absPath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #16
Source File: _abspath.py From gputools with BSD 3-Clause "New" or "Revised" License | 5 votes |
def abspath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #17
Source File: perlin.py From gputools with BSD 3-Clause "New" or "Revised" License | 5 votes |
def abspath(myPath): import sys, os """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #18
Source File: glwidget.py From spimagine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def absPath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #19
Source File: mainsettings.py From spimagine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def absPath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #20
Source File: slice_view.py From spimagine with BSD 3-Clause "New" or "Revised" License | 5 votes |
def absPath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #21
Source File: Helper.py From SupergirlOnCrypt with Do What The F*ck You Want To Public License | 5 votes |
def path(self, relative_path): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS except Exception: base_path = os.path.abspath(".") return os.path.join(base_path, relative_path)
Example #22
Source File: _abspath.py From gputools with BSD 3-Clause "New" or "Revised" License | 5 votes |
def abspath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #23
Source File: _abspath.py From gputools with BSD 3-Clause "New" or "Revised" License | 5 votes |
def abspath(myPath): """ Get absolute path to resource, works for dev and for PyInstaller """ try: # PyInstaller creates a temp folder and stores path in _MEIPASS base_path = sys._MEIPASS 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)
Example #24
Source File: helper.py From webp-converter with Apache License 2.0 | 5 votes |
def resource_path(relative_path): # noinspection PyProtectedMember return join(sys._MEIPASS, relative_path) if hasattr(sys, '_MEIPASS') else relative_path
Example #25
Source File: asset_access.py From node-launcher with MIT License | 5 votes |
def assets_directory(self): if getattr(sys, 'frozen', False): # noinspection PyUnresolvedReferences,PyProtectedMember return os.path.join(sys._MEIPASS, 'assets') else: class_file_path = os.path.realpath(__file__) directory_path = os.path.join(class_file_path, os.path.pardir) abs_directory_path = os.path.abspath(directory_path) return abs_directory_path
Example #26
Source File: _utils.py From qtmodern with MIT License | 5 votes |
def resource_path(relative_path): if hasattr(sys, '_MEIPASS'): return join(sys._MEIPASS, dirname(abspath(__file__)), relative_path) return join(dirname(abspath(__file__)), relative_path)
Example #27
Source File: videoservice.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def getAppPath(path: str = None) -> str: if VideoService.frozen and getattr(sys, '_MEIPASS', False): app_path = sys._MEIPASS else: app_path = os.path.dirname(os.path.realpath(sys.argv[0])) return app_path if path is None else os.path.join(app_path, path)
Example #28
Source File: __main__.py From vidcutter with GNU General Public License v3.0 | 5 votes |
def get_path(path: str=None, override: bool=False) -> str: if override: if getattr(sys, 'frozen', False) and getattr(sys, '_MEIPASS', False): # noinspection PyProtectedMember, PyUnresolvedReferences return os.path.join(sys._MEIPASS, path) return os.path.join(os.path.dirname(os.path.realpath(sys.argv[0])), path) return ':{}'.format(path)
Example #29
Source File: utils.py From vorta with GNU General Public License v3.0 | 5 votes |
def get_asset(path): if getattr(sys, 'frozen', False): # we are running in a bundle bundle_dir = os.path.join(sys._MEIPASS, 'assets') else: # we are running in a normal Python environment bundle_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'assets') return os.path.join(bundle_dir, path)
Example #30
Source File: application.py From Il2cppSpy with MIT License | 5 votes |
def resource_path(relative): if hasattr(sys, '_MEIPASS'): return os.path.join(sys._MEIPASS, relative) return os.path.join(relative)