title: .profile in Ubuntu is running desired Python script, but script is not working as usual?
body: <p>I'm creating a background changer for Ubuntu using Python, mostly for fun. When I run the script from the shell, it works and alternates the background between images in a certain folder. Now I am trying to run the script through .profile so that it runs upon login. The script is definitely running--I put a print statment in the relevant function, and when I hit 'alt, ctrl, f3', I see the output of the print statement--but for whatever reason, the background will not change when the function is called this way. I don't think it's a matter of running it from a non-local directory, either--as I said, if I run 'python program/python/desktop_changer/main.py', the desktop changer runs just fine.</p>
  
  <p>Here are the relevant parts of the function:</p>
  
  <pre><code>if __name__ == "__main__":
      time.sleep(15)
      os.chdir(os.path.dirname(os.path.realpath(__file__)))
      while True:
  
      #Set pic, set timer, run continously
      for img in os.listdir('pics/'):
          #This next line is functional when I hit 'alt, ctrl, f3', outputting the paths for new images every ten seconds
          print(os.path.abspath('pics/' + img))
          set_gnome_wallpaper(os.path.abspath('pics/' + img))
          time.sleep(float(10))
  </code></pre>
  
  <p>And set_gnome_wallpaper():</p>
  
  <pre><code>def set_gnome_wallpaper(file_path):
      command = "gsettings set org.gnome.desktop.background picture-options 'zoom' &amp;&amp; gsettings set org.gnome.desktop.background picture-uri file://'%s'" % file_path
      subprocess.call(command, shell=True)
  </code></pre>
  
  <p>And in ~/.profile: (SPE and 20 are irrelevant arguments and their uses are commented out until I can get this running correctly)</p>
  
  <pre><code>python /home/chessie/program/python/desktop_changer/main.py SPE 20 &amp;
  </code></pre>