From: Bruce S. <Bru...@nc...> - 2008-12-22 00:22:42
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type"> </head> <body bgcolor="#ffffff" text="#000000"> Thanks much for figuring this out!<br> <br> Bruce Sherwood<br> <br> Stef Mientki wrote: <blockquote cite="mid:494...@ru..." type="cite"> <pre wrap="">thanks Bruce, Bruce Sherwood wrote: </pre> <blockquote type="cite"> <pre wrap="">The problem with installing two Visuals for one Python is the conflict between the name "visual" being then ambiguous. I just tried a little experiment of changing the name of the new site-packages/visual to visual5 and installing Visual 3 as well, then trying to do "from visual5 import *", but that didn't work. Maybe someone else will figure out how to fight through the name problems. Another workaround is to install Visual 3, save a copy of the relevant materials from site-packages, then delete from site-packages. Then install Visual 5, save a copy of these materials. Now you can swithc back and forth by copying the desired files into site-packages from the saved copies. </pre> </blockquote> <pre wrap=""><!---->I played around, and found the following work around: - I installed Vpython version 5 on a different computer (afraid of harming my own work-PC ;-) - called the visual directory "visual5" - copied that visual5 directory to site-packages - created the function below, which I place on a central place where all programs can reach it - and add a line to all VPython programs "Get_Visual ( ... )" before importing visual, seems to work great. cheers, Stef def Get_Visual ( Version = 3 ) : import os, sys print sys.path for path in sys.path : if path.endswith ( 'site-packages') : print path break vpath = os.path.join ( path, 'visual' ) if ( Version == 3 ) and os.path.exists ( vpath + '3' ) : print 'Visual ==> V3', vpath os.rename ( vpath, vpath + '5' ) os.rename ( vpath + '3', vpath ) elif ( Version == 5 ) and os.path.exists ( vpath + '5' ) : print 'Visual ==> V5', vpath os.rename ( vpath, vpath + '3' ) os.rename ( vpath + '5', vpath ) Get_Visual ( 3 ) from visual import * ... ------------------------------------------------------------------------------ _______________________________________________ Visualpython-users mailing list <a class="moz-txt-link-abbreviated" href="mailto:Vis...@li...">Vis...@li...</a> <a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/visualpython-users">https://lists.sourceforge.net/lists/listinfo/visualpython-users</a> </pre> </blockquote> </body> </html> |