Jason Tackaberry wrote:
> On Tue, 2009-06-09 at 09:06 +1200, Bernard Mentink wrote:
>> Hmmm, well that is not my user experience.
> [...]
>>   File "/usr/local/bin/freevo", line 218, in get_python
>>     child.fromchild.close()
>> AttributeError: 'Popen' object has no attribute 'fromchild'
> 
> Ah, ok, but this has nothing to with the fact that the popen2 module is
> deprecated.  Just for the record. :)
> 
>>From what I can see, the code just looks broken.  Duncan,
> subprocess.Popen is not API compatible with popen2.Popen3, and it looks
> like maybe the code is assuming that.  Specifically, subprocess.Popen
> objects use stdout/stderr and stdin attributes rather than fromchild and
> tochild.
> 
> Am I missing something?  If not, this code path must not be very well
> travelled?  Is there something Bernard can do to workaround?


What it means is that freevo has not found the version of Python that is
installed, it is looking for python, python2 and incorrectly for
python2.4. So the simple workaround is to link python (or python2) to
the installed version.

ln -svf python2.5 /usr/bin/python

Attached is a patch that should fix this problem and correct the version
checking of python.

Duncan
Index: freevo
===================================================================
--- freevo	(revision 11582)
+++ freevo	(working copy)
@@ -34,6 +34,7 @@
 import sys
 import time
 import pprint
+import re
 
 from subprocess import Popen, PIPE
 from optparse import Option, BadOptionError, OptionValueError, OptionParser, IndentedHelpFormatter
@@ -178,15 +179,15 @@
     get the newest version of python [ with freevo installed ]
     """
     _debug_('version=%r' % (sys.version))
-    if sys.hexversion >= 0x02040000:
+    if sys.hexversion >= 0x02060000:
         # python seems to be ok
-        search = ('python', 'python2')
-    elif sys.hexversion >= 0x02030000:
-        # try python2.4, else take python
-        search = ('python2.4', 'python')
+        search = ('python', 'python2.6', 'python2')
+    elif sys.hexversion >= 0x02050000:
+        # try python2.5, else take python
+        search = ('python2.5', 'python')
     else:
-        # python is too old, try to find python2.4 or python2
-        search = ('python2.4', 'python2')
+        # python is too old, try to find python2.5 or python2
+        search = ('python2.5', 'python2')
 
     for python in search:
         for path in os.environ['PATH'].split(':'):
@@ -215,10 +216,8 @@
                         return python, data[:-1]
 
                 child.wait()
-                child.fromchild.close()
-                if child.childerr:
-                    child.childerr.close()
-                child.tochild.close()
+                child.stdout.close()
+                child.stdin.close()
 
     # nothing found? That's bad!
     if check_freevo:
@@ -364,8 +363,6 @@
     revision = 0
     if os.path.isdir('.svn'):
         try:
-            from subprocess import Popen, PIPE
-            import re
             os.environ['LC_ALL']='C'
             p = Popen(["svn", "info", "--revision=BASE"], stdout=PIPE, env=os.environ)
             info = p.communicate()[0]
@@ -475,7 +472,7 @@
         #
         # no runtime, get best python version
         #
-        python = get_python(0)
+        python = get_python(False)
         if not python:
             sys.exit("Can't find python >= 2.5")
         python = [ python ]
@@ -488,7 +485,7 @@
         for path in os.environ['PATH'].split(':'):
             if os.path.isfile(os.path.join(path, freevo_script)):
                 freevo_script = os.path.join(path, freevo_script)
-    python, freevo_python = get_python(1)
+    python, freevo_python = get_python(True)
     if not python:
         sys.exit("Can't find python version with installed freevo")
 
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Freevo-users mailing list
Freevo-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freevo-users

Reply via email to