py2app throws [errno 35] Resource Not Available during unconditional imports

試著忘記壹切 提交于 2019-12-11 13:15:29

问题


I'm using python 2.7 installed via macports, pyobjc, cocoa and notably scipy (via FlowCytometryTools) with py2app to create a small mac application. Py2app's setup.py run with sudo python setup.py py2app completes nicely with -A for testing, but is unable to complete when running without that parameter to create a full .app build.

The build process will get a variable distance through the unconditional imports and then give error: [Errno 35] Resource temporarily unavailable and immediately exit. The number of unconditional import lines that complete before the error occurs changes. The longest run so far was seen when running immediately after a reboot. I've tried running with and without removing the previous build/dist folders to no effect.

Modules not found (unconditional imports):
...
 * builtins.int (Cython.Build.Inline, Cython.Compiler.ExprNodes, IPython.utils._tokenizeerror: [Errno 35] Resource temporarily unavailable

My setup.py looks like this:

import sys
sys.setrecursionlimit(1500) #required to avoid recursion triggered early exit in py2app while compiling scipy. (default is 1000)
from setuptools import setup

APP = ['FlowMac.py']
DATA_FILES = ['FlowMac_Main.xib']
OPTIONS = {'argv_emulation': True}

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

and the imports section of my python file FlowMac.py looks like this:

from Cocoa import *
from Foundation import *
from AppKit import *
from FlowCytometryTools import * #file/data handling via scipy and pandas
from pylab import * #graphing histograms

Commenting out both the FlowCytometryTools and the pylab imports allows the py2app build to complete but of course renders the program nonfunctional.

  • What is happening?
  • How can I get more information on which resource is unavailable?
    • was hitting a recursion limit a clue to my problem?

I'm running Yosemite on a MacBook Pro with 8GB RAM, so I'm very surprised to be hitting a wall here. Thanks for your time.

UPDATE 4/29/2015: Importing everything works fine if I remove my .xib from the datafiles array of the py2app launcher setup.py. A blank file with just import Cocoa, Foundation and Appkit works fine. Importing the xib with any one of FlowCytometryTools, pylab, scipy, matplotlib, numpy does not work. pylab and FlowCytometryTools rely on the other three, and any one of scipy, matplotlib or numpy brings in py2app recipies for the other two. One of these recipies isn't working with the xib, but I don't know why...


回答1:


No experience with py2app, but I am wondering if you tried generating a more minimal version of the code that would fail to aid troubleshooting?

Maybe having FlowMac.py include nothing but the import statements:

import Cocoa
import Foundation
import AppKit
import FlowCytometryTools
import pylab

Also could you narrow it down to whether the problem appears due to pylab or due to FlowCytometryTools? (By commenting them out individually?)




回答2:


From my testing, this error seems to be caused by the log output itself from py2app. Try redirecting standard error to a file:

python setup.py py2app 2>error_log

This should work around the error.



来源:https://stackoverflow.com/questions/27727621/py2app-throws-errno-35-resource-not-available-during-unconditional-imports

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!