gpt4 book ai didi

python - py2app IOError : [Errno 63] File name too long:

转载 作者:太空狗 更新时间:2023-10-30 02:05:56 25 4
gpt4 key购买 nike

我正在尝试使用 python 2.6 在 OS X 10.6 上使用 py2app 打包 PySide 应用程序。

我遇到的问题是 py2app 似乎陷入循环并递归地将相同的目录路径附加到其自身,然后最终如上所示命中 Python 文件太长的 IOError。下面是我得到的堆栈跟踪

     copying /Users/mlakewood/Documents/Programming/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-
universal/python2.6-standalone/app/collect/_builtinSuites/__init__.pyc -> /Users/mlakewood/Documents/Programming/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/_builtinSuites
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/build_app.py", line 579, in _run
self.run_normal()
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/build_app.py", line 650, in run_normal
self.create_binaries(py_files, pkgdirs, extensions, loader_files)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/build_app.py", line 718, in create_binaries
self.copy_package_data(item, self.collect_dir)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/build_app.py", line 809, in copy_package_data
copy_tree(pth, os.path.join(target_dir, fname))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/util.py", line 501, in copy_tree
dry_run=dry_run, condition=condition))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/util.py", line 501, in copy_tree
dry_run=dry_run, condition=condition))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/util.py", line 501, in copy_tree
dry_run=dry_run, condition=condition))

snip...(很多行都与上面和下面的行相同)

解压...

File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/util.py", line 501, in copy_tree
dry_run=dry_run, condition=condition))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/util.py", line 501, in copy_tree
dry_run=dry_run, condition=condition))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/util.py", line 501, in copy_tree
dry_run=dry_run, condition=condition))
File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/py2app/util.py", line 504, in copy_tree
preserve_times, update, dry_run=dry_run)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/file_util.py", line 165, in copy_file
_copy_file_contents(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/file_util.py", line 47, in _copy_file_contents
fdst = open(dst, 'wb')
IOError: [Errno 63] File name too long: '/Users/mlakewood/Documents/Programming/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect/_builtinSuites/__init__.pyc'
> /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/file_util.py(47)_copy_file_contents()
-> fdst = open(dst, 'wb')

下面是我的setup.py文件

"""
This is a setup.py script generated by py2applet

Usage:
python setup.py py2app
"""

from setuptools import setup

APP = ['gui.py']
DATA_FILES = []
OPTIONS = {}
#OPTIONS = {'argv_emulation': True}

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

最佳答案

这个问题真的很老了,但是我昨晚遇到了同样的问题,找到了解决办法。结果对我来说,问题是 py2app 试图在另一个包含引用模块的文件夹内生成 builddist 文件夹的副产品通过正在构建的代码。

由于 py2app 默认将 builddist 文件夹放在当前工作目录中,这意味着如果您在与代码引用的其他模块相同的工作目录中重新编写构建脚本。

我通过使用 py2app 选项强制在下面当前目录的父目录中创建 builddist 目录来解决这个问题,但您可以将它们放在您选择的任何位置并实现相同的目的:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import py2app
import sys
from distutils.core import setup
from os import getcwd
from pathlib import Path

sys.argv.append('py2app')
setup(app=['<your_code.py>'],
options=dict(py2app=dict(bdist_base=str(Path(getcwd()).parent)
+ '/build', dist_dir=str(Path(getcwd()).parent) + '/dist')))

关于python - py2app IOError : [Errno 63] File name too long:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7701255/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com