<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>Snipplr</title>
<link>http://snipplr.com/language/python/tags/batch</link>
<description>Recent snippets posted on Snipplr.com</description>
<language>en-us</language>
<pubDate>Sat, 25 May 2013 08:50:18 GMT</pubDate>
<item>
<title>(Python) Getting shovel to work in windows so python methods can be run like individual executables - pckujawa</title>
<link>http://snipplr.com/view/66267/getting-shovel-to-work-in-windows-so-python-methods-can-be-run-like-individual-executables/</link>
<description><![CDATA[ <p>I had hear about a method to run a method like an executable, with the arguments being passed in from the commandline. Apparently, Ruby has this with the Rake project. Well, Python has it with [Shovel](http://devblog.seomoz.org/2012/03/shovel-rake-for-python). Only the instructions didn't work for me on windows, so I had to create a batch script to call `shovel` correctly.

So here's my setup. I installed shovel using `easy_install shovel`, which placed it in my python scripts folder (C:\Python27\Scripts, which is in my PATH). I created 'shovel.bat' (see source) in the same folder. So now I can call `shovel` from anywhere and it will call my batch file, passing the parameters into shovel.

For completeness, here is my working directory structure (note the subfolder called shovel):

	D:.
	│   song log.log
	│   Untitled_10.mp3
	│   Untitled_11.mp3
	│   Untitled_2.mp3
	│   Untitled_3.mp3
	│   Untitled_4.mp3
	│   Untitled_5.mp3
	│   Untitled_6.mp3
	│   Untitled_7.mp3
	│   Untitled_8.mp3
	│   Untitled_9.mp3
	│
	└───shovel
	        tasks.py

My python script is incomplete but can be run by shovel using `shovel tasks.extractSongInfo "log file name.log"` from the directory above the 'shovel' directory. Here's the script:


	from shovel import task
	
	@task
	def extractSongInfo(logFile):
	    """Given a log file with lines like
	"{date}	INFO	 Currently playing - Song: {songName} - Artist: {artist} - Length: {numSeconds}"
	return a collection of extracted info."""
	    opId = "Extracting song info" # operation ID
	    print opId
	    print 'Done: ' + opId</p> ]]></description>
<pubDate>Sun, 22 Jul 2012 07:44:22 GMT</pubDate>
<guid>http://snipplr.com/view/66267/getting-shovel-to-work-in-windows-so-python-methods-can-be-run-like-individual-executables/</guid>
</item>
<item>
<title>(Python) Batch Download Sequence data from NCBI using EUtils - itskkumaran</title>
<link>http://snipplr.com/view/57580/batch-download-sequence-data-from-ncbi-using-eutils/</link>
<description><![CDATA[ <p>Based on http://www.ncbi.nlm.nih.gov/books/NBK25498/#chapter3.Application_3_Retrieving_large</p> ]]></description>
<pubDate>Wed, 03 Aug 2011 21:32:42 GMT</pubDate>
<guid>http://snipplr.com/view/57580/batch-download-sequence-data-from-ncbi-using-eutils/</guid>
</item>
<item>
<title>(Python) Using the 'sleep' function - eliluminado</title>
<link>http://snipplr.com/view/44774/using-the-sleep-function/</link>
<description><![CDATA[ <p>Dos formas de usar la función 'sleep' de Python.

Two ways to use the 'sleep' function in Python.</p> ]]></description>
<pubDate>Wed, 24 Nov 2010 14:55:43 GMT</pubDate>
<guid>http://snipplr.com/view/44774/using-the-sleep-function/</guid>
</item>
<item>
<title>(Python) Batch iPod Video Encoder - OtonVM</title>
<link>http://snipplr.com/view/26600/batch-ipod-video-encoder/</link>
<description><![CDATA[ <p>A simple python script for taking all files in the base dir and encoding them (and than removing them) into another folder. Handbrake, quality based, ipod nano compatible video, mac or windows.</p> ]]></description>
<pubDate>Sun, 17 Jan 2010 06:20:20 GMT</pubDate>
<guid>http://snipplr.com/view/26600/batch-ipod-video-encoder/</guid>
</item>
<item>
<title>(Python) YouTube Batch Download Script - abhiomkar</title>
<link>http://snipplr.com/view/6451/youtube-batch-download-script/</link>
<description><![CDATA[ <p>You</p> ]]></description>
<pubDate>Sun, 25 May 2008 14:02:29 GMT</pubDate>
<guid>http://snipplr.com/view/6451/youtube-batch-download-script/</guid>
</item>
</channel>
</rss>