title: Python: why would Python stop saving in the present working directory
body: <p>Whenever I would save a file in Python, it would save in the present working directory. For some unknown reason, Python has stopped saving in the <code>pwd</code>.  My figures are now being saved in the directory below it.  So instead of saving in <code>/Documents/.../OrbitalMechanics/OrbitalNotes</code> they are now being saved in <code>/Documents/.../OrbitalMechanics</code>.  My operating system is Ubuntu 13.04, I am using Emacs, and writing the program from the terminal.  When I am calling my <code>.py</code> file, the path is <code>emacs ~/Documents/.../OrbitalMechanics/OrbitalNotes/stumpff.py</code>.  Therefore, I am in the correct directory.</p>
  
  <p>What would cause this problem?  I haven't altered anything I normal do when I save a figure.</p>
  
  <p>The program where this is occurred is below:</p>
  
  <pre><code>#!/usr/bin/env ipython                                                              
  #  This program plots the Stumpff functions C(z) and S(z)                           
  
  import numpy as np
  import pylab
  from matplotlib.ticker import MaxNLocator
  
  
  def C(z):
      if z &gt; 0:
          return (1 - np.cos(z ** 0.5)) / z
      elif z &lt; 0:
          return (np.cosh(np.sqrt(-z)) - 1) / -z
      return 0.5
  
  
  def S(z):
      if z &gt; 0:
          return (np.sqrt(z) - np.sin(z ** 0.5)) / np.sqrt(z) ** 3
      elif z &lt; 0:
          return (np.sinh(np.sqrt(-z)) - np.sqrt(-z)) / np.sqrt(-z) ** 3
      return 1.0 / 6.0
  
  
  vC = np.vectorize(C)
  vS = np.vectorize(S)
  
  z = np.linspace(-50.0, 500.0, 500000.0)
  y = vC(z)
  y2 = vS(z)
  
  fig = pylab.figure()
  ax = fig.add_subplot(111)
  ax.plot(z, y, 'r')
  ax.plot(z, y2, 'b')
  pylab.legend(('$C(z)$', '$S(z)$'), loc = 0)
  pylab.xlim((-50, 0))
  pylab.ylim((0, 15))
  pylab.xlabel('$z$')
  pylab.gca().xaxis.set_major_locator(MaxNLocator(prune = 'lower'))
  pylab.savefig('stumpffneg50to0.eps', format = 'eps')
  </code></pre>
  
  <p><strong>Edit:</strong></p>
  
  <p>Previously, when I saved a figure, the figure would save in the directory where the <code>.py</code> file was located even if I wasn't in that directory.  That is, I could be in the home directory, run the file in <code>emacs</code>, and the file would be where I wanted it to save.  Now, this isn't the case even though the file used to always save in the location of the python script.</p>
  
  <p>If I run the file from the terminal as <code>ipython ~/path/to/file</code>, the figures will save where the <code>.py</code> file is located.</p>
  
  <p>If I open the file in <code>emacs</code> and use <code>C-c C-c</code> to run the file, the files will save one level down from the directory the <code>.py</code> file is in.</p>
  
  <p>If I cd to the directory then open the file in <code>emacs</code>, the file again will save one level down.</p>