【发布时间】:2020-10-22 11:01:22
【问题描述】:
我正在使用 py2app 创建一个生成测试链接的程序。即使没有导入任何代码,由于某种原因它不允许我打开它并给出以下错误:
在 system.log 中,我得到以下信息:
Jul 1 18:31:16 samanthas-imac com.apple.xpc.launchd[1] (org.pythonmac.unspecified.generatetestlink.2576[62449]): Service exited with abnormal code: 255
这是我的 setup.py 文件:
"""
This is a setup.py script generated by py2applet
Usage:
python setup.py py2app
"""
from setuptools import setup
APP = ['generatetestlink.py']
DATA_FILES = []
OPTIONS = {'argv_emulation': True,
'packages': ['pyperclip']}
setup(
app=APP,
data_files=DATA_FILES,
options={'py2app': OPTIONS},
setup_requires=['py2app'],
)
这是我的代码(省略了一些部分):
import pyperclip
def makelink():
quitting = False
while quitting==False:
originallink = input("Enter the original link: ")
dimy = input("Enter the height: ")
endcodelist = originallink.split("/m/")
while(len(endcodelist)<2):
endcodelist = originallink.split("/m/")
originallink = input("Invalid link. Enter the original link: ")
while type(dimy)!=int:
try:
dimy=int(dimy)
except:
dimy = input("Invalid height. Enter the height as an integer: ")
print('stop2')
endcode = endcodelist[1]
newlink = "https://"+endcode+"&width=800&height="+str(dimy)
pyperclip.copy(newlink)
print(newlink)
end = input("Enter another link? (y or n): ")
if end == "n":
quitting=True
makelink()
关于修复的任何想法? 我尝试了 pyinstaller,但它也不起作用。它说图像丢失。
【问题讨论】:
-
请注意,我还尝试使用 sudo 运行 setup.py,因为我认为这可能是权限问题。
标签: python-3.x macos py2app