开发者

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

开发者 https://www.devze.com 2023-04-12 05:35 出处:网络
Im trying to package a PySide app with py2app on OS X 10.6 with python 2.6. The problem i\'m getting it that it seems like py2app is getting stuck in a loop and recursively appending the same directo

Im trying to package a PySide app with py2app on OS X 10.6 with python 2.6.

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

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_con开发者_如何学编程tents()
-> fdst = open(dst, 'wb')

and below is my setup.py file

"""
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 dist folders inside of another folder that contained modules referenced by the code being built.

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.

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:

#!/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:

/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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号