简体   繁体   English

py2app IOError:[Errno 63]文件名太长:

[英]py2app IOError: [Errno 63] File name too long:

Im trying to package a PySide app with py2app on OS X 10.6 with python 2.6. 我试图用python 2.6在OS X 10.6上用py2app打包PySide应用程序。

The problem i'm getting it that it seems like py2app is getting stuck in a loop and recursively appending the same directory path onto its self, and then it eventually hits the Python file too long IOError as above. 我得到的问题似乎是py2app被卡在一个循环中并递归地将相同的目录路径附加到它自己,然后它最终命中Python文件太长IOError如上所述。 Below is the stack trace I get 下面是我得到的堆栈跟踪

     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... (lots of lines that are all the same as the one above and below) snip ...(许多行与上面和下面的行相同)

unsnip... unsnip ...

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')

and below is my setup.py file 以下是我的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']
)

This question is really old, but I ran into the same problem last night and found a solution. 这个问题真的很老了,但昨晚我遇到了同样的问题并找到了解决方案。 Turned out for me that the problem was a byproduct of py2app trying to generate the build and dis t folders inside of another folder that contained modules referenced by the code being built. 对我来说,问题是py2app的副产品,试图在包含正在构建的代码引用的模块的另一个文件夹内生成builddis t文件夹。

Since py2app defaults to placing the build and dist folders in the current working directory, that means you're in trouble if you're writing a build script in the same working directory as other modules being referenced by your code. 由于py2app默认将builddist文件夹放在当前工作目录中,这意味着如果您在与代码引用的其他模块相同的工作目录中编写构建脚本,则会遇到麻烦。

I fixed the problem by using py2app options to force the build and dist directories to be created in the parent of the current directory below, but you could put them wherever you choose and achieve the same thing: 我通过使用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')))

Check to see if the path has any symlinks that might cause infinite recursion. 检查路径是否有任何可能导致无限递归的符号链接。 Open up Terminal app, and type this: 打开终端应用,然后输入:

ls -l /Users/mlakewood/Documents/Programming/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect

If you see something like this after doing the ls -l : 如果在执行ls -l后看到类似的内容:

/Users/mlakewood/Documents/Programming/DataWrangler/build/bdist.macosx-10.6-universal/python2.6-standalone/app/collect -> ../../../../../build/

Then thats what is causing the issue. 那就是造成这个问题的原因。 But there definately is something causing an infinite recursive loop in the way the script is searching for the file. 但肯定会有一些因为脚本搜索文件的方式导致无限递归循环。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM