Addendum - forgot to mention that the problem with checking the extension of sys.argv[0] is that sys.argv[0] is not set until after sitecustomize.py is run (and it needs to be in sitecustomize.py not an imported module due to the top-level SyntaxError problem mentioned in my other post). Cheers again for your elegant solution. Giles