py2App在别名模式下工作,而不是在最终分发文件中工作

时间:2018-02-21 18:25:00

标签: python py2app

所以我终于有了一个应用程序在py2app别名模式下工作。我可以打开文件,效果很好。删除构建& dist文件并运行python setup.py py2app,包收到错误。为什么要这样做?

magnolia.py:

    from splinter import Browser
import webbrowser

with Browser() as browser:
    # Visit URL
    url = "http://magnolia.msstate.edu/k12/login.asp"
    browser.visit(url)
    browser.fill('username', 'magn0897')
    # Find and click the 'search' button
    button = browser.find_by_name('btnG')
    # Interact with elements
    browser.find_by_xpath('//html/body/div[3]/div[1]/div/section/form/input').click()
#Open browser in new tab to keep browser open
webbrowser.open_new_tab('http://magnolia.msstate.edu/k12/elementary.asp')

#source: https://splinter.readthedocs.io/en/latest/mouse-interaction.html


#Instructions:
# Activate: go into bin.... $source activate
# To Update Requirements File: $pip freeze > requirements.txt

#http://www.marinamele.com/from-a-python-script-to-a-portable-mac-application-with-py2app

setup.py:

from setuptools import setup

APP = ['magnolia.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,'iconfile': 'robot.icns'}

setup(
    app=APP,
    data_files=DATA_FILES,
    options={'py2app': OPTIONS},
    setup_requires=['py2app'],
)

在终端打开magnolia.app之后: enter image description here

0 个答案:

没有答案