On Mac OSX 10.6 I installed the music21 package for python by using

python setup.py install

in the directory named in

distutils.sysconfig.get_python_lib()

which was

/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages

Now, if I run Python as an admin, like

sudo python

then I can get at the package:

>> import music21

but if I run Python without admin privileges, Python cannot find the package. Has anyone encountered this problem? I have verified that the library files are in the right place (namely, a subdirectory music21 of site-packages). If I do

chmod -R a+r *

in this directory, it finds the package but throws an exception during importing. Does anyone have any advice?

EDIT: This is the output of Python:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/music21/__init__.py", line 80, in <module>
    import base
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/music21/base.py", line 60, in <module>
    from music21 import tie
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/music21/tie.py", line 16, in <module>
    from music21.musicxml import translate as musicxmlTranslate
ImportError: No module named musicxml

It seems to me as though I'm not chmod-ing everything that needs to be chmodded. Shouldn't there be a simple way that configures everything for a regular user?

link|improve this question
What's the exception in the last para? – ed. Sep 24 '11 at 10:13
feedback

1 Answer

up vote 1 down vote accepted

On Unix systems, the r privilege on a directory lets you see properties of the directory itself, but you need the x privilege to be allowed to list its contents. Therefore, try doing the following:

chmod -R a+rX *

In contrast to a+x (lowercase x), which means "make every file executable and directory list-able to everyone", a+X (uppercase x) means "make every file executable and directory list-able to everyone if the x privilege is already to set to at least one of user, group and other".

If, therefore, the privileges are, for example, rw-r--r--, they won't be changed, but if they are rw-r-xr--, they will become rwxr-xr-x (because x had been set for group).

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.