# HG changeset patch -- Bitbucket.org # Project galaxy-dist # URL http://bitbucket.org/galaxy/galaxy-dist/overview # User Nate Coraor <nate@bx.psu.edu> # Date 1288376296 14400 # Node ID 23844e86e6167c79737a7e0396c39e350e95d1c4 # Parent 247c19db7f8987d9da245bc750043188d4a7c373 Fix error on all uploads < 4b. An exception was raised in the bigwig sniffer, which does a binary unpack. --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -213,8 +213,11 @@ class BigWig(Binary): def _unpack( self, pattern, handle ): return struct.unpack( pattern, handle.read( struct.calcsize( pattern ) ) ) def sniff( self, filename ): - magic = self._unpack( "I", open( filename ) ) - return magic[0] == self._magic + try: + magic = self._unpack( "I", open( filename ) ) + return magic[0] == self._magic + except: + return False def set_peek( self, dataset, is_multi_byte=False ): if not dataset.dataset.purged: dataset.peek = "Binary UCSC %s file" % self._name