[Zope3-checkins] SVN: Zope3/trunk/utilities/i18nextract.py For some strange reason, the Zope 3 root was added to the path. We have

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Jan 9 05:52:11 EST 2007


Log message for revision 71844:
  For some strange reason, the Zope 3 root was added to the path. We have 
  to remove it, so it is not used for importing. It would try to import 
  "test" and execute the testrunner. Worst of all is that it is only a 
  problem on MacOS X and Windows. Weird.
  
  

Changed:
  U   Zope3/trunk/utilities/i18nextract.py

-=-
Modified: Zope3/trunk/utilities/i18nextract.py
===================================================================
--- Zope3/trunk/utilities/i18nextract.py	2007-01-09 10:48:31 UTC (rev 71843)
+++ Zope3/trunk/utilities/i18nextract.py	2007-01-09 10:52:11 UTC (rev 71844)
@@ -166,4 +166,10 @@
     maker.write()
 
 if __name__ == '__main__':
+    # Make sure that the Zope3 root directory is not in the path, so that
+    # test.py is not imported accidently. This seems to be only a problem on
+    # MacOS X and Windows.
+    root = os.path.abspath(os.path.dirname(os.path.dirname(sys.argv[0])))
+    sys.path[:] = [p for p in sys.path if os.path.abspath(p) != root]
+
     main()



More information about the Zope3-Checkins mailing list