check version of boto

14,207 views
Skip to first unread message

Dan Sheffner

unread,
Jul 22, 2010, 1:03:36 AM7/22/10
to boto-...@googlegroups.com
Mitchell Garnaat sent me a bunch of spot instance links for EC2 and moved me over to this board.  Thanks again.

Is there any easy way to check what version of boto is running? My problem is that I ran into an 1.8 version instead of 1.9.  I saw in the __init__.py file both have Version and UserAgent.  Maybe I'm missing something obvious but I did this:

Version = '1.9b'
UserAgent = 'Boto/%s (%s)' % (Version, sys.platform)
config = Config()

def getVersion():
        return Version

def getUserAgent():
        return UserAgent

For this output:

Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import boto
>>> print boto.getVersion()
1.9b
>>> print boto.getUserAgent()
Boto/1.9b (linux2)
>>> if 1.9 >= float(boto.getVersion()[0:-1]):
...     print "Spot Instances Supported"
... else:
...     print "Please install boto 1.9 or greater"
...     sys.exit()

Thanks again and keep up the good work.

Chris Moyer

unread,
Jul 22, 2010, 9:22:57 AM7/22/10
to boto-...@googlegroups.com
You don't need to modify the __init__.py file at all, just use:

>>> boto.Version

to get the running version number.

> --
> You received this message because you are subscribed to the Google Groups
> "boto-users" group.
> To post to this group, send email to boto-...@googlegroups.com.
> To unsubscribe from this group, send email to
> boto-users+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/boto-users?hl=en.
>

--
Chris Moyer

Reply all
Reply to author
Forward
0 new messages