title: Using bash to run python script
body: <p>I have a python script that takes in a .txt file and outputs a .txt file. I want to create a bash file that I can click on from my desktop to execute the python script. </p>
  
  <p>So far I have:</p>
  
  <pre><code>#!/bin/bash
  cd /Desktop; 
  cd ./py-data;
  python ./grab.py;
  exit;
  </code></pre>
  
  <p>This just opens up the python script. Ideally I would like to click on the bash script and have the python script to run in the back ground and just produce the output without having to open the python script.</p>
  
  <p>Solution:</p>
  
  <ol>
  <li><p>change py.bat to py.command </p></li>
  <li><p>at terminal:</p>
  
  <p><code>$ cd ~/Desktop
  $ chmod 755 py.command</code> </p></li>
  <li><p>open code on vim and place in (from: <a href="https://stackoverflow.com/questions/2920416/configure-bin-shm-bad-interpreter">./configure : /bin/sh^M : bad interpreter</a>):</p>
  
  <p><code>:set fileformat=unix</code></p></li>
  <li><p>Changed code too:</p>
  
  <p><code>#!bin/bash
  cd ~/Desktop
  python search.py
  exit;</code> </p></li>
  </ol>