Python 2.4 will be widespread in the world for some time to come - the final 
2.4.x maintenance release went out in December, 2008. Since python is often 
used by system management tools, many linux distributions ship versions that 
are long in the tooth - I routinely run into 2.3 and even 2.2 on rhel systems. 
I don't think tashi needs to support every crusty old python out there, but 
2.4.x and on seems reasonable given that the change is simple and it will let 
most potential users try tashi without having to upgrade python.

Dan

On 1/8/09 8:58 AM, "Ryan, Michael P" <[email protected]> wrote:

There are several places in the code that have the newer try/except/finally 
syntax.  It is either necessary to replace all of them or to upgrade python.  
What versions of python are other people using in their environments?

- Michael

________________________________
From: Daniel Mercer [mailto:[email protected]]
Sent: Thursday, January 08, 2009 11:51 AM
To: [email protected]
Cc: KunWang
Subject: Re: [question] getting tashi run smoothly

Howdy,

Prior to 2.5, to get try/except/finally behavior you need to nest two try 
blocks - one of the so-called 'python warts'. Here is a patch to client.py that 
ought to let it work with earlier pythons.

Dan M.

Index: client.py
===================================================================
--- client.py   (revision 732752)
+++ client.py   (working copy)
@@ -162,21 +162,22 @@
                sys.exit(-1)
        args = map(lambda x: eval(x), sys.argv[1:])
        try:
-               res = f(*args)
-               if (os.getenv("USE_HTML_TABLES")):
-                       try:
-                               makeHTMLTable(res)
-                       except:
+               try:
+                       res = f(*args)
+                       if (os.getenv("USE_HTML_TABLES")):
+                               try:
+                                       makeHTMLTable(res)
+                               except:
+                                       pprint(res)
+                       else:
                                pprint(res)
-               else:
-                       pprint(res)
-       except TashiException, e:
-               print e.msg
-               exitCode = e.errno
-       except TypeError, e:
-               print e
-               print "\t" + getFunctionInfo(function)
-               exitCode = -1
+               except TashiException, e:
+                       print e.msg
+                       exitCode = e.errno
+               except TypeError, e:
+                       print e
+                       print "\t" + getFunctionInfo(function)
+                       exitCode = -1
        finally:
                client._transport.close()
        sys.exit(exitCode)



On 1/8/09 7:34 AM, "Ryan, Michael P" <[email protected]> wrote:

I did a little more reading on the finally clause and it appears  that it only 
started working in it's current form on python2.5.
I installed  CentOS 5.2 and I was able to get the same error message with 
python 2.4.3, but  once I installed 2.5.4, the messages went away.
Can you try running the  following and report the version numbers?

$ /usr/bin/env python
$ /usr/bin/python

If either reports 2.4.3, I think you only need to change the #! at  the top of 
the file (client.py) to point to python2.5

- Michael


________________________________
From: Ryan,  Michael P [mailto:[email protected]]
Sent: Wednesday, January 07, 2009 5:54 PM
To: [email protected]
Cc:  KunWang
Subject: RE: [question] getting tashi run  smoothly

Those with_statement imports are unneccessary.  I just  committed a fix that 
removes them.  Just for reference, I am using Python  2.5.2.
Please try using trunk instead of the imported code (tashi/trunk  instead of 
tashi/import/tashi-intel-r399).
I'm not sure why "finally" would  be considered a syntax error.  I'm assuming 
you didn't modify the code  once you checked it out.
I'm currently downloading and installing CentOS 5  to test on and I will let 
you know if I am able to reproduce the error.
The only other things I can think of checking are to revert to the  older 
version of python now that the with imports are removed and to make sure  you 
have identical files:

$ md5sum ./trunk/src/tashi/client/client.py  
./import/tashi-intel-r399/src/tashi/client/client.py
de302c54d3236e468ba7c2e82d6ceafe   ./trunk/src/tashi/client/client.py
7e9eabb435e989272a7a4d620f53f6ba   
./import/tashi-intel-r399/src/tashi/client/client.py

-  Michael


________________________________
From: KunWang [mailto:[email protected]]
Sent:  Tuesday, January 06, 2009 7:37 PM
To: Ryan, Michael P
Cc:  [email protected]
Subject:  RE: [question] getting tashi run smoothly

Hello,

Thanks for your help.

I am  using Xen on  CentOS 5.0 .

The default version of python is  2.4.3.
Following is the log when I was trying to do "make" under  tashi-intel-r399 
directory.
[r...@mvm tashi-intel-r399]# make
Building  tashi.services...
  File "./build.py", line  3
    from __future__ import  with_statement
SyntaxError: future feature with_statement is not  defined
make: *** [src/tashi/services] Error 1

Then I  installed newer version of Python(Python 2.5.4)
The error happened in  different place.
[root@ mvm tashi-intel-r399]# make
Building  tashi.services...
Generating Python code for  'services.thrift'...
Copying generated code to 'tashi.services'  package...
Generatign Python code for 'messagingthrift'...
Copying  generated code to 'tashi.messaging.messagingthrift' package...
Generating  client symlinks...
  File "../src/tashi/client/client.py", line  163
    finally:
          ^
SyntaxError:  invalid syntax
make: *** [bin/getInstances] Error 1

Does tashi  require particular version of Python?
By the way, thrift is available on  my machine.

Thanks  again,
Kun


From: Ryan, Michael P [mailto:[email protected]]
Sent: Monday, January 05, 2009 11:28 AM
To:  KunWang
Cc: [email protected]
Subject:  RE: [question] get tashi run smoothly


Using migration in Tashi  is dependent on using the migration provided by the 
VMM underneath it.   Are you using Qemu/KVM or Xen?  If you are using Qemu/KVM, 
you need  to be aware of some of the limitations inherent in that VMM's 
implementation  of live migration (the disk image has to be served from the 
same file server,  etc.).



The Makefile exists to  reorganize the source tree to be usable -- as you 
stated, python is not a  compiled language.  It also uses thrift to dynamically 
create some python  code.  I suspect you would see many errors if you didn't 
have thrift  installed.  Thrift is another Apache Incubator project 
(http://incubator.apache.org/thrift/).



I'm glad to see you're  trying to use Tashi and I'm glad to help you however I 
can.  If you need  more specific directions, we're working on some, but in the 
mean time, please  send any error messages you are getting so that I can 
respond to those  individually.  The only request I have is that you send 
questions like  this to [email protected],  which is CC'd on this 
message.   Thanks.



-  Michael

________________________________

From: KunWang [mailto:[email protected]]
Sent:  Friday, January 02, 2009 11:29 AM
To: Ryan, Michael  P
Subject: [question] get tashi run  smoothly
Dear  Michael,

I watched your talk on 
http://blogs.intel.com/research/2008/10/cloud_computing_in_pittsburgh.php.
>From  your talk, I find you are already  using tashi for migration. However, I 
> encountered some problem
when I was trying to use tashi to establish cloud  computing environment in my 
lab.

I checked out my source code  from
http://incubator.apache.org/tashi/source_code.html

I  followed this tutorial  to use tashi
http://opencirrus.intel-research.net/index.php/Using_Tashi

I  found there are several  Makefiles in the source tree.  Except for  the 
utilities, many error happened when
I was trying to use GNU make to  "compile" the source code.
 Since Python is an interpretive  language, I  found the Makefile didn't do too 
much concrete job. I can't find
enough  documents on that website on installing tashi.

I am very  interested in tashi. Could you please give me some advice to get 
tashi run  smoothly like you?
Thanks in  advance.

Regards,
Kun



Reply via email to