Installation on Yosemite - pyobjc-core: setup.py - line 358: TypeError: 'set' object does not support item assignment

Issue #112 resolved
Greg Gauthier
created an issue

Here's the full error message:

    outfiles = self.copy_tree(self.build_dir, self.install_dir)
  File "/usr/local/lib/python2.7/site-packages/setuptools/command/install_lib.py", line 88, in copy_tree
    exclude = self.get_exclusions()
  File "setup.py", line 358, in get_exclusions
    result[fn] = 1
TypeError: 'set' object does not support item assignment
Installing 'pyobjc-core' failed (status 1)

And, here's the offending class:

class oc_install_lib (install_lib.install_lib):
    def run(self):
        verify_platform()
        install_lib.install_lib.run(self)

    def get_exclusions(self):
        result = install_lib.install_lib.get_exclusions(self)
        if hasattr(install_lib, '_install_lib'):
            outputs = install_lib._install_lib.get_outputs(self)
        else:
            outputs = install_lib.orig.install_lib.get_outputs(self)

        for fn in outputs:
            if 'PyObjCTest' in fn:
                result[fn] = 1

        for fn in os.listdir('PyObjCTest'):
            result[os.path.join('PyObjCTest', fn)] = 1
            result[os.path.join(self.install_dir, 'PyObjCTest', fn)] = 1


        return result

I printed out result and fn and got this:

FN =  build/bdist.macosx-10.10-x86_64/egg/PyObjCTest/arrays.so
RESULT =  set([])

Obviously, you can't set result[fn] because result is a set, not a dictionary. So, as a local hack, I added this after your initial result assignment in get_exclusions:

result = dict.fromkeys(result,0)

(it just turns result into a dictionary). That did the trick!

Installed /usr/local/lib/python2.7/site-packages/pyobjc_core-3.1-py2.7-macosx-10.10-x86_64.egg
Processing dependencies for pyobjc-core==3.1
Finished processing dependencies for pyobjc-core==3.1

My system:

OSX 10.10.1 
XCODE 6.1 (with command-line tools v 2339)
Python 2.7.8_1 from Brew

Comments (2)

  1. Log in to comment