python类_MEIPASS的实例源码

Main.py 文件源码 项目:Crypter 作者: sithis993 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def start_gui(self):
    '''
    @summary: Initialises and launches the ransomware GUI screen
    '''

    # Get Crypter start_time
    start_time = self.get_start_time()

    app = wx.App()
    # TODO Update this to new path and place in __init__
    #sys._MEIPASS = "..\\build\\images"
    crypter_gui = Gui.Gui(
        image_path=sys._MEIPASS, 
        start_time=start_time,
        decrypter=self,
        config=self.__config)

    crypter_gui.Show()
    app.MainLoop()
gam.py 文件源码 项目:GAMADV-XTD 作者: taers232c 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def readDiscoveryFile(api_version):
  disc_filename = u'%s.json' % (api_version)
  disc_file = os.path.join(GM.Globals[GM.GAM_PATH], disc_filename)
  if hasattr(sys, u'_MEIPASS'):
    pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename)
  else:
    pyinstaller_disc_file = None
  if os.path.isfile(disc_file):
    json_string = readFile(disc_file, continueOnError=True, displayError=True)
  elif pyinstaller_disc_file:
    json_string = readFile(pyinstaller_disc_file, continueOnError=True, displayError=True)
  else:
    json_string = None
  if not json_string:
    invalidDiscoveryJsonExit(disc_file)
  try:
    discovery = json.loads(json_string)
    return (disc_file, discovery)
  except ValueError:
    invalidDiscoveryJsonExit(disc_file)
gam.py 文件源码 项目:GAMADV-XTD 作者: taers232c 项目源码 文件源码 阅读 32 收藏 0 点赞 0 评论 0
def initGDataObject(gdataObj, api):
  if hasattr(sys, u'_MEIPASS') and not GM.Globals[GM.CACERTS_TXT]:
    GM.Globals[GM.CACERTS_TXT] = os.path.join(sys._MEIPASS, u'httplib2', u'cacerts.txt')
    os.environ['REQUESTS_CA_BUNDLE'] = GM.Globals[GM.CACERTS_TXT]
    os.environ['DEFAULT_CA_BUNDLE_PATH'] = GM.Globals[GM.CACERTS_TXT]
  _, _, api_version, cred_family = API.getVersion(api)
  disc_file, discovery = readDiscoveryFile(api_version)
  GM.Globals[GM.CURRENT_API_USER] = None
  credentials = getClientCredentials(cred_family)
  try:
    GM.Globals[GM.CURRENT_API_SCOPES] = list(set(list(discovery[u'auth'][u'oauth2'][u'scopes'])).intersection(credentials.scopes))
  except KeyError:
    invalidDiscoveryJsonExit(disc_file)
  if not GM.Globals[GM.CURRENT_API_SCOPES]:
    systemErrorExit(NO_SCOPES_FOR_API_RC, Msg.NO_SCOPES_FOR_API.format(discovery.get(u'title', api_version)))
  getGDataOAuthToken(gdataObj, credentials)
  if GC.Values[GC.DEBUG_LEVEL] > 0:
    gdataObj.debug = True
  return gdataObj
app.py 文件源码 项目:FuME 作者: fupadev 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def run():
    app = QtWidgets.QApplication(sys.argv)

    # Translates standard-buttons (Ok, Cancel) and mac menu bar to german
    try:
        base_path = sys._MEIPASS
    except Exception:
        base_path = os.path.abspath(".")
    path = os.path.join(base_path, 'bin', 'qtbase_de.qm')
    translator = QtCore.QTranslator()
    translator.load(path)
    app.installTranslator(translator)

    window = MainWindow()
    window.show()
    app.exec_()
pyinstaller?????.py 文件源码 项目:Python_Study 作者: thsheep 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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.
ttpassgen.py 文件源码 项目:TTPassGen 作者: tp7309 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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.
pyi_multiprocess_pool.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
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.
pyi_multiprocess_forking.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 40 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
        if hasattr(sys, 'frozen'):
            # We have to set original _MEIPASS2 value from sys._MEIPASS
            # to get --onefile mode working.
            # Last character is stripped in C-loader. We have to add
            # '/' or '\\' at the end.
            os.putenv('_MEIPASS2', sys._MEIPASS + os.sep)
        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', '')
test_pyqt5_qml.py 文件源码 项目:driveboardapp 作者: nortd 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def main():
    # This is required so that app.quit can be invoked when the quickview
    # is closed. If it is not present then the app does not exit. It is 
    # possibly a bug in PyQt or Qt.
    global app 

    app = QtWidgets.QApplication(sys.argv)
    quickview = QtQuick.QQuickView()
    if getattr(sys, 'frozen', None):
        basedir = sys._MEIPASS
    else:
        basedir = os.path.dirname(__file__)

    # The app dir is in the default import path but we can't put the QtQuick
    # import lib dirs there because of a name clash (on OSX) with the QtQuick
    # dll.
    print(("Qt5 Qml import paths: " \
                + unicode(quickview.engine().importPathList())))
    quickview.setSource(QtCore.QUrl('qrc:/hello.qml'))
    quickview.engine().quit.connect(app.quit)
    quickview.show()

    app.exec_()
pancakeViewerApp.py 文件源码 项目:PancakeViewer 作者: forensicmatt 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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.
pypdfocr_multiprocessing.py 文件源码 项目:cryptoluggage 作者: miguelinux314 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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', '')
bb_downloader_func.py 文件源码 项目:unist_bb_downloader 作者: kcm4482 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
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.
MaruCrawler.py 文件源码 项目:MaruCrawler 作者: KiririnLover 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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.
Utilities.py 文件源码 项目:EventMonkey 作者: devgc 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
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
EventMonkey.py 文件源码 项目:EventMonkey 作者: devgc 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
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.
gam.py 文件源码 项目:GAMADV-X 作者: taers232c 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def readDiscoveryFile(api_version):
  disc_filename = u'%s.json' % (api_version)
  disc_file = os.path.join(GM.Globals[GM.GAM_PATH], disc_filename)
  if hasattr(sys, u'_MEIPASS'):
    pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename)
  else:
    pyinstaller_disc_file = None
  if os.path.isfile(disc_file):
    json_string = readFile(disc_file, continueOnError=True, displayError=True)
  elif pyinstaller_disc_file:
    json_string = readFile(pyinstaller_disc_file, continueOnError=True, displayError=True)
  else:
    json_string = None
  if not json_string:
    invalidDiscoveryJsonExit(disc_file)
  try:
    discovery = json.loads(json_string)
    return (disc_file, discovery)
  except ValueError:
    invalidDiscoveryJsonExit(disc_file)
gam.py 文件源码 项目:GAMADV-X 作者: taers232c 项目源码 文件源码 阅读 33 收藏 0 点赞 0 评论 0
def initGDataObject(gdataObj, api):
  if hasattr(sys, u'_MEIPASS') and not GM.Globals[GM.CACERTS_TXT]:
    GM.Globals[GM.CACERTS_TXT] = os.path.join(sys._MEIPASS, u'httplib2', u'cacerts.txt')
    os.environ['REQUESTS_CA_BUNDLE'] = GM.Globals[GM.CACERTS_TXT]
    os.environ['DEFAULT_CA_BUNDLE_PATH'] = GM.Globals[GM.CACERTS_TXT]
  _, _, api_version, cred_family = API.getVersion(api)
  disc_file, discovery = readDiscoveryFile(api_version)
  GM.Globals[GM.CURRENT_API_USER] = None
  credentials = getClientCredentials(cred_family)
  try:
    GM.Globals[GM.CURRENT_API_SCOPES] = list(set(list(discovery[u'auth'][u'oauth2'][u'scopes'])).intersection(credentials.scopes))
  except KeyError:
    invalidDiscoveryJsonExit(disc_file)
  if not GM.Globals[GM.CURRENT_API_SCOPES]:
    systemErrorExit(NO_SCOPES_FOR_API_RC, Msg.NO_SCOPES_FOR_API.format(discovery.get(u'title', api_version)))
  getGDataOAuthToken(gdataObj, credentials)
  if GC.Values[GC.DEBUG_LEVEL] > 0:
    gdataObj.debug = True
  return gdataObj
nrf5_multi_prog.py 文件源码 项目:nRF5-multi-prog 作者: NordicPlayground 项目源码 文件源码 阅读 48 收藏 0 点赞 0 评论 0
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.
StashHelper.py 文件源码 项目:stash-scanner 作者: senuido 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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.
enhance_goodreads_export_gui.py 文件源码 项目:Enhance-GoodReads-Export 作者: PaulKlinger 项目源码 文件源码 阅读 55 收藏 0 点赞 0 评论 0
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.
pyi_multiprocess_pool.py 文件源码 项目:mac-package-build 作者: persepolisdm 项目源码 文件源码 阅读 39 收藏 0 点赞 0 评论 0
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.
pyi_multiprocess_forking.py 文件源码 项目:mac-package-build 作者: persepolisdm 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def __init__(self, *args, **kw):
        if hasattr(sys, 'frozen'):
            # We have to set original _MEIPASS2 value from sys._MEIPASS
            # to get --onefile mode working.
            # Last character is stripped in C-loader. We have to add
            # '/' or '\\' at the end.
            os.putenv('_MEIPASS2', sys._MEIPASS + os.sep)
        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', '')
test_pyqt5_qml.py 文件源码 项目:mac-package-build 作者: persepolisdm 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def main():
    # This is required so that app.quit can be invoked when the quickview
    # is closed. If it is not present then the app does not exit. It is 
    # possibly a bug in PyQt or Qt.
    global app 

    app = QtWidgets.QApplication(sys.argv)
    quickview = QtQuick.QQuickView()
    if getattr(sys, 'frozen', None):
        basedir = sys._MEIPASS
    else:
        basedir = os.path.dirname(__file__)

    # The app dir is in the default import path but we can't put the QtQuick
    # import lib dirs there because of a name clash (on OSX) with the QtQuick
    # dll.
    print(("Qt5 Qml import paths: " \
                + unicode(quickview.engine().importPathList())))
    quickview.setSource(QtCore.QUrl('qrc:/hello.qml'))
    quickview.engine().quit.connect(app.quit)
    quickview.show()

    app.exec_()
main.py 文件源码 项目:shadowsocks-pyqt 作者: falseen 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
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.
parseutility.py 文件源码 项目:IoTcube-HMark-cli 作者: squizz617 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def get_version():
    global osName
    global bits

    pf = platform.platform()
    if 'Windows' in pf:
        osName = 'w'
    elif 'Linux' in pf:
        osName = 'l'
    else:
        osName = 'osx'

    bits, _ = platform.architecture()
    if '64' in bits:
        bits = '64'
    else:
        bits = '86'

    if osName == 'osx':
        bits = ''

# sys.path.append(sys._MEIPASS)
parseutility.py 文件源码 项目:IoTcube-HMark-cli 作者: squizz617 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def setEnvironment(caller):
    get_version()
    global javaCallCommand
    if caller == "GUI":
        # try:
        #   base_path = sys._MEIPASS
        # except:
        #   base_path = os.path.abspath(".")
        cwd = os.getcwd()
        if osName == 'w':
            # full_path = os.path.join(base_path, "FuncParser.exe")
            javaCallCommand = os.path.join(cwd, "FuncParser-opt.exe ")

        elif osName == 'l' or osName == "osx":
            # full_path = os.path.join(base_path, "FuncParser.jar")
            # javaCallCommand = "java -Xmx1024m -jar " + full_path + " "
            javaCallCommand = "java -Xmx1024m -jar \"" + os.path.join(cwd, "FuncParser-opt.jar") + "\" "

    else:
        if osName == 'w':
            javaCallCommand = "FuncParser-opt.exe "
        elif osName == 'l' or osName == "osx":
            javaCallCommand = "java -Xmx1024m -jar \"FuncParser-opt.jar\" "
Functions.py 文件源码 项目:TWTools 作者: ZeX2 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def resource_path(relative_path):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    if hasattr(sys, '_MEIPASS'):
        return path.join(sys._MEIPASS, relative_path)
    return path.join(path.abspath("."), relative_path)
files.py 文件源码 项目:Fuxenpruefung 作者: andb0t 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def resource_path(basePath, relativePath):
    """ Get absolute path to resource, works for dev and for PyInstaller """
    try:
        # PyInstaller creates a temp folder and stores path in _MEIPASS
        basePath = sys._MEIPASS
    except Exception:
        basePath = os.path.abspath(".")
    finalPath = os.path.join(basePath, relativePath)
    if sys.platform != 'win32':
        finalPath = finalPath.replace('\\', '/')
    return finalPath
pyinstaller_helper.py 文件源码 项目:uPyLoader 作者: BetaRavener 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
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)
3ds-to-cia.py 文件源码 项目:3ds-to-cia 作者: drizzt 项目源码 文件源码 阅读 29 收藏 0 点赞 0 评论 0
def get_tools_path():
    if getattr(sys, 'frozen', False):
        # we are running in a bundle
        bundle_dir = sys._MEIPASS
    else:
        # we are running in a normal Python environment
        bundle_dir = os.path.dirname(os.path.abspath(__file__))

    if sys.platform == "win32":
        return os.path.join(bundle_dir, "tools", "win" + BITS)
    elif sys.platform == "linux" or sys.platform == "linux2":
        return os.path.join(bundle_dir, "tools", "linux" + BITS)


问题


面经


文章

微信
公众号

扫码关注公众号