Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

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_contents()
-> 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']
)
like image 775
Mark Lakewood Avatar asked Oct 09 '11 03:10

Mark Lakewood


2 Answers

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')))
like image 73
s0kr8s Avatar answered Nov 20 '22 22:11

s0kr8s


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.

like image 42
chown Avatar answered Nov 20 '22 22:11

chown