1

I'm trying to run a setup.py script (for mnemosyne). The script fails, and I'm pretty sure I know how to fix the problem, if I could only find the file to edit. The problem is that the traceback points to a non-existent file:

  File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 49, in locate
    loader=loader.filename)
TypeError: dyld_find() got an unexpected keyword argument 'loader'

I believe that should be loader_path. The problem is that MachOGraph.py file doesn't exist -- not anywhere in my current path, or in my anaconda distribution. There is a build/bdist.macosx-10.5-x86_64/ directory, but no egg. There are a few MachOGraph.py files on my system, but none of them have that line. Nothing under this directory contains the string loader.filename.

What's going on? How can I find that file?

For completeness, here is the complete traceback:

Traceback (most recent call last):
  File "/Users/mike/.continuum/anaconda/lib/python2.7/site-packages/ipdb/__main__.py", line 157, in main
    pdb._runscript(mainpyfile)
  File "/Users/mike/.continuum/anaconda/lib/python2.7/pdb.py", line 1233, in _runscript
    self.run(statement)
  File "/Users/mike/.continuum/anaconda/lib/python2.7/bdb.py", line 400, in run
    exec cmd in globals, locals
  File "<string>", line 1, in <module>
  File "setup.py", line 241, in <module>
    app = py2app_app
  File "/Users/mike/.continuum/anaconda/lib/python2.7/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/Users/mike/.continuum/anaconda/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/Users/mike/.continuum/anaconda/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 654, in run
    self._run()
  File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 860, in _run
    self.run_normal()
  File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 950, in run_normal
    self.create_binaries(py_files, pkgdirs, extensions, loader_files)
  File "/usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg/py2app/build_app.py", line 1110, in create_binaries
    platfiles = mm.run()
  File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOStandalone.py", line 105, in run
    mm.run_file(fn)
  File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 84, in run_file
    self.scan_node(m)
  File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 110, in scan_node
    m = self.load_file(filename, caller=node)
  File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 93, in load_file
    newname = self.locate(name, loader=caller)
  File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOStandalone.py", line 23, in locate
    newname = super(FilteredMachOGraph, self).locate(filename, loader)
  File "build/bdist.macosx-10.5-x86_64/egg/macholib/MachOGraph.py", line 49, in locate
    loader=loader.filename)
TypeError: dyld_find() got an unexpected keyword argument 'loader'
Mike
  • 19,114
  • 12
  • 59
  • 91

3 Answers3

2

This issue is caused by Pillow, you can use pip uninstall Pillow to uninstall it, then this question will disappear.

svassr
  • 5,538
  • 5
  • 44
  • 63
Runbing
  • 88
  • 1
  • 9
0

Python takes the filename as reported in the bytecode when printing a traceback. In this case, the bytecode contains filenames that are generated to produce a Python egg, a format that contains at least the bytecode files. These paths reflect the build directory relative to the package as it was built.

In this case, it is the py2app installer that includes macholib as a installation requirement; setuptools downloads the source code for that library and produces an egg on demand, in the same location as the py2app egg. I'd look in /usr/local/src/Mnemosyne-2.3.1/py2app-0.8.1-py2.7.egg for a macholib-1.6-py2.7.egg directory.

Community
  • 1
  • 1
Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
  • `macholib` itself is definitely not anywhere in the source, or in anaconda. Maybe it got downloaded and removed? In any case, I installed `py2app` and `macholib` myself, then re-ran and it worked (in the sense that I got past that error). Thanks for the hint. – Mike Jul 02 '14 at 19:23
  • @Mike: yes, it's not clear immediately where setuptools puts it when `py2app` is being installed in the `/usr/local/src/Mnemosyne-2.3.1`, I expected it to be located there too. There are environment variables that can be set, it could be installed in `/tmp` for all we know. – Martijn Pieters Jul 02 '14 at 20:22
0

With macholib1.7, from line 46 of **/MachOGraph.py...:

            try:
                fn = dyld_find(filename, env=self.env,
                    executable_path=self.executable_path,
                    loader=loader.filename)
                self.trans_table[(loader.filename, filename)] = fn
            except ValueError:
                return None

Change line 49 to:

                    loader_path=loader.filename)
papahabla
  • 1,448
  • 18
  • 18