1

Mac osx で python でアプリを作成しています。myapp.py python スクリプト ファイルと setup.py から myapp.app を作成するために py2app を使用しています。myapp.py コードでは、terminal-notifier を次のように使用しています。

def notify(title, subtitle, message):
    t = '-title {!r}'.format(title)
    s = '-subtitle {!r}'.format(subtitle)
    m = '-message {!r}'.format(message)
    os.system('terminal-notifier {}'.format(' '.join([m, t, s])))

notify(
    title    = 'Title message',
    subtitle = 'with python',
    message  = 'Validating user'
)

としてインストールした後、通知を表示するように正常に動作していsudo gem install terminal-notifierます。terminal-notifier がシステムに存在しますin location /Library/Ruby。私の問題はhow to include this in py2app for developing my app, as py2app is not able to include terminal-notifier in myapp.app. 私の setup.py は

from setuptools import setup

APP=['myapp.py']
DATA_FILES= [('',['config.cfg'])]
OPTIONS={'iconfile':'cc.icns','argv_emulation': True,'plist':{'CFBundleShortVersionString':'1.0'}}

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

2 に答える 2