Making my python script executable causes a 'import site' failed; use -v for traceback (Mac OSX)
<p>Sorry for the newbie question but I am struggling to resolve this. I have added #!/usr/bin/python as the first line of my script and made the file executable. The script runs fine if I run it via the python interpreter i.e 'python ./argPass.py' but fails with the following error if I try to execute the file directly.  I presume it is a problem with either my $PATH or $PYTHONPATH environment variables but I am not sure what they should be set as.</p>

<p>relevent bits of path </p>

<blockquote>
  <p>echo $PATH
  /Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin</p>
  
  <p>echo $PYTHONPATH
  :/Users/steve/Documents/workspace/xscan/src/:/Users/steve/Documents/workspace/mkvfx/src/:/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7</p>
</blockquote>

<pre><code> 'import site' failed; use -v for traceback Traceback (most recent call
 last):   File "./argPass.py", line 7, in &lt;module&gt;
     import mkvfx   File "/Users/steve/Documents/workspace/mkvfx/src/mkvfx.py", line 8, in
 &lt;module&gt;
     import os, errno   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/os.py",
 line 398, in &lt;module&gt;
     import UserDict   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/UserDict.py",
 line 84, in &lt;module&gt;
     _abcoll.MutableMapping.register(IterableUserDict)   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/abc.py",
 line 109, in register
     if issubclass(subclass, cls):   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/abc.py",
 line 184, in __subclasscheck__
     cls._abc_negative_cache.add(subclass)   File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/_weakrefset.py",
 line 84, in add
     self.data.add(ref(item, self._remove)) TypeError: cannot create weak reference to 'classobj' object
</code></pre>
