Python - Very Strange sys.path behavior
<p>The entry for sys.path[0] is <code>'/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode'</code>.  The Python docs say this should be the working directory of the script.  Any idea what could be going on?</p>

<p>When I run Python from the interactive interpreter and do <code>import sys; print sys.path[0];</code> it prints <code>''</code> which seems to be right.  </p>

<p>But when my Python script is called from a perl script I get the above entry for <code>sys.path[0]</code>.</p>

<p><strong>Other info:</strong></p>

<ul>
<li>I'm running Python 2.7. </li>
<li>I'm on Ubuntu 11.10 64 bit.</li>
<li>My working directory should be /mnt/galaxyData/custom/MSG_toy</li>
<li>The perl script and the python script it's calling are located in /mnt/galaxyData/custom/MSG_toy/msg  (That msg directory is a symbolic link if it matters)</li>
</ul>

<p>Here is everything on sys.path:</p>

<pre><code>['/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode',
 '/mnt/galaxyData/custom/msg',
 '/usr/local/lib/python2.7/dist-packages/bx_python-0.7.1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/pip-1.0.2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/amqplib-1.0.2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/BeautifulSoup-3.2.0-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/boto-2.1.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Fabric-1.3.2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/ssh-1.7.9-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/ipython-0.11-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Logbook-0.3-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/lxml-2.3.2-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/Mako-0.5.0-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/MarkupSafe-0.15-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/nose-1.1.2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/numpy-1.6.1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/Paste-1.7.5.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/PasteScript-1.7.5-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/PasteDeploy-1.5.0-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/python_cjson-1.0.5-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/pyOpenSSL-0.13-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/PyYAML-3.10-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/Routes-1.12.3-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/simplejson-2.2.1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/Sphinx-1.1.2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/docutils-0.8.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Jinja2-2.6-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Pygments-1.4-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/WebHelpers-1.3-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/WebOb-1.2b2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/xlrd-0.7.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Cython-0.15.1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/Pyrex-0.9.9-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/virtualenv-1.6.4-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/tornado-2.1.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/Twisted-11.0.0-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/biopython-1.58-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/celery-2.4.2-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/pysam-0.5-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/python_dateutil-1.5-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/kombu-1.4.3-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/anyjson-0.3.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/DendroPy-3.9.0-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/HTSeq-0.5.3p3-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/networkx-1.5-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/pandas-0.5.0-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/pygr-0.8.2-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/pysparse-1.2_dev-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/rpy2-2.2.4dev_20111114-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/rpy2_bioconductor_extensions-0.2.5_dev-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/scikits.learn-0.8.1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/scikits.statsmodels-0.3.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/scipy-0.10.0-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/sympy-0.7.1-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/CouchDB-0.8-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/h5py-2.0.1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/MySQL_python-1.2.3-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/pymongo-2.0.1-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/pysqlite-2.6.3-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/psycopg2-2.4.2-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.7.3-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/gnuplot_py-1.8-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/PIL-1.1.7-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/pydot-1.0.25-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/pyparsing-1.5.6-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/pygooglechart-0.3.0-py2.7.egg',
 '/usr/local/lib/python2.7/dist-packages/reportlab-2.5-py2.7-linux-x86_64.egg',
 '/usr/local/lib/python2.7/dist-packages/bcbio_nextgen-0.3a-py2.7.egg',
 '/mnt/galaxyData/custom/bin/python_libs',
 '/mnt/galaxyData/custom/MSG_toy',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old',
 '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages/PIL',
 '/usr/lib/python2.7/dist-packages/gst-0.10',
 '/usr/lib/python2.7/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.7',
 '/usr/lib/python2.7/dist-packages/ubuntu-sso-client',
 '/usr/lib/python2.7/dist-packages/wx-2.8-gtk2-unicode']
</code></pre>
